Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [filenames]

File name is a name used to identify a file uniquely on given file system.

2
votes
0answers
31 views

include special characters when sorting files

I'm trying to make Linux include special characters when sorting filesnames. The sort order I'm trying to achieve is: first all special characters, then numbers, then letters (case insensitive). The ...
1
vote
1answer
44 views

chcon: cannot access (file): No such file or directory

I'm taking a Linux course and I have no idea on how to get past this annoying error: chcon: cannot access path: No such file or directory But before that we had to define our virtual host Perhaps ...
4
votes
2answers
162 views

File name problem(?)

I have downloaded audio with youtube-dl, and then I wanted to change name with mv: mv "Powerwolf - Resurrection By Erection-Hiu1hPdJk-Y.mp3" "Powerwolf - Resurrection by Errection.mp3 >" But, ...
0
votes
5answers
60 views

How to get the filenames and their absolute paths in one line?

I want to list all the files in a folder and their respective absolute paths line by line as below, filename1 /home/.../file1 filename2 /home/.../file2 filename3 /home/.../file3 I tried ...
1
vote
0answers
33 views

Is there a command specifically designed to manipulate file path strings, such as changing foo/bar/baz -> bar/baz?

I'm trying to modify the output of git diff --name-only from a subdirectory of a git project such that it only contains relative paths in the current directory. I know how to do this with sed/grep, ...
0
votes
1answer
60 views

Using “find” to delete files with a pattern of underscore/letters

Is there a way to find and remove files with a pattern like this (where the pattern is only that there are two underscores in the file name, separated by letters or numbers) ex. /file_name_name I ...
0
votes
1answer
45 views

Can you hide files and folders on MacOS the same way as Linux?

I'm trying to make a Python script that creates a hidden folder for a specific file I'm creating across any platform. I'm aware you can do this easily with Linux by placing "." as the beginning of a ...
-1
votes
0answers
55 views

Nemo file manager is completely ignoring `_` at the beginning of directory name, when sorting

Ex. suppose some directories are named absorbing appreciate arrive connect depend drop few fold littlel popcorn shrill sticky In Windows, if I put _ before the directories, it would be at the top, ...
0
votes
3answers
41 views

“grep -Rl” results as vi arguments with proper space support

I am trying to do something like vi `grep -Rl 'keyword'` But I want to support spaces in the file names. vi "`grep -Rl 'keyword'`" Does not do what I need, it turns the grep output in a single ...
6
votes
1answer
237 views

Escape a mm/dd/YY backup date in a file name

I have been trying to: cp file.csv file.$(date +%D).csv But it fails because the filenames is: file.03/27/19.csv with the slash of separate directories. And I have been trying again to: cp file....
1
vote
6answers
55 views

Get list of folders that are after certain number

I have a folder which subfolder naming convention is like yyyymm for e.g. 200801, 200803 etc. I want to list down folder after 201412 via command line means to upload to S3. Is there a way to do it?
2
votes
1answer
365 views

Find fails if filename contains brackets

I'm trying to use find inside a loop to create a variable that contains a file matching the filename + desired string Example: file1.en.srt file1.mkv file1.pt.srt This is the relevant part of the ...
2
votes
1answer
58 views

How to differentiate an executable sh file, and a source sh file?

I have sh files that are executable, and others that are only meant to be sourced by executable ones. On the executable ones I use no extension at all, and have the first line as #! /bin/sh. On the ...
-2
votes
2answers
31 views

how to remove all characters after and including “?” in filename?

I have a large amount of files that were downloaded and ended up having what looks like authentication parameters added to the filename which I would like to remove. Examples: file1.doc?...
2
votes
2answers
44 views

Print Folders Missing .txt Filetype

I have 150 directories in a parent directory. Some of them have .txt files, others do not. I would like to print which folders do NOT have a .txt file. How can I achieve this?
4
votes
1answer
425 views

Dot in front of file [duplicate]

If there is a file and the filename starts with a dot in front of it. Does that mean that you created the file and you are hiding stuff in it or can the files get created on their own without you ...
0
votes
4answers
92 views

How to shuffle file names randomly in a directory

Say i have a directory of filenames: file_010.ext file_011.ext ... file_99.ext What's the simplest way to take each file and randomly rename it to any other name in the directory, without there ...
-1
votes
1answer
127 views

Filename with dot in front [duplicate]

If there is a file and the filename starts with a dot, does that mean you created the file and you are hiding stuff in it, or can the files get created on their own without you creating the filename?
-1
votes
2answers
50 views

How to batch rename files in folder [closed]

I have a zip file where each file is named the following original.jpg.1.png original.jpg.2.png The files are actually jpegs How do I go about renaming them to the following? original1.jpg original2....
1
vote
0answers
48 views

Sort directories before files and underscore first with ls

When using 'ls' i want to sort directories first and then all files AND sort directories/files with underscore first. Here is an example: _folder2 folder2 _file2 file I can sort directories first ...
1
vote
2answers
106 views

How to mass rename files with regular expressions [closed]

I have a bunch of folders in a directory with files in them. Most of the filenames have region codes (retropie), and the scrubber will not match roms with single letter region codes (u,j,e,etc.). I ...
1
vote
2answers
41 views

How to recursively move one file type but only when another file type is also present?

In my directory tree, some subfolders contain both *.flac and *.mp3 files, but other subfolders contain only *.mp3 files. I'd like to move all of the *.mp3 files to another destination (a different ...
3
votes
0answers
54 views

I can see but cannot delete a file [closed]

I am running Linux Mint.I tried to copy a file with the file manager. It looked like it hung. I can see the file in the directory with ls -l: -rwxr-xr-x 1 mike domain^users 20 Mar 1 08:57 'output (...
0
votes
2answers
68 views

Why does Linux allow a symbolic link to itself?

Because of a typo I found out that this is allowed: ln -s useless useless. Then, as expected ls useless/* triggers this error message: ls: cannot access 'useless/*': Too many levels of symbolic ...
7
votes
2answers
526 views

What is wrong with my use of “find -print0”? [closed]

I'm confused by this experiment (in Bash): $ mkdir 'foo\n' $ find . -print0 | od -c 0000000 . \0 . / f o o \ n \0 0000012 As you can see, "find" is correctly delimiting the output ...
1
vote
2answers
52 views

Finding a rogue script changing filenames?

I've got a server that is used as an SFTP endpoint and a script living somewhere else that periodically uploads to the server. At a particular time every day all the files in the upload folder get ...
2
votes
0answers
53 views

Given a pathname and a symlink to a directory in the pathname, is there a command which can return an equivalent pathname making use of the symlink?

Sometimes I have a long pathname, and want to shorten it by some precreated symlink to a directory in the pathname. Specifically, given a pathname /path/to/file, and a symbolic link /symlink to a ...
0
votes
0answers
48 views

IFS variable and filenames with spaces and newlines

(Using Bash 4.4 and 5.0) I am dealing with the issue of filenames that contain spaces, newlines and backslashes. I often read the suggestion to use code like this: oldIFS=$IFS IFS= while read -rd ...
-1
votes
1answer
26 views

Grab last youtube video index and re-download .description

after I had download youtube videos with youtube-dl -cit -f 140 ' , I forget to download the .description as well... so I have bunch of files without description, I want to redownload the description ...
1
vote
1answer
27 views

Can't remove file from terminal folder

I would like to remove the .xlsx file below in terminal folder. When I right click and do delete, it gives error: no such file. When I do 'ls' in command line it is not listed either. I refresh the ...
1
vote
1answer
67 views

How to use the ls command to show all files except those ending in a specific string

I have a directory with files of all kinds and I wanted to use the ls command to list all of them, except those with a name that ends in .config, but I do not get how to do it.
5
votes
1answer
352 views

Why does scp's strict filename checking reject quoted last component but not others?

When I try to scp a file with a slash in its path, the path is quoted for the local host, and the last path component is additionally quoted for the remote host, like scp host:"a/b/'c'" ., it fails ...
0
votes
0answers
24 views

Add file number to beginning of each file in directory [duplicate]

If I have a directory, how do I add the number of the file to beginning of the filename? For example, the directory would look something like this: file.txt another_file.txt And the expected output ...
0
votes
1answer
41 views

What distro allows you to create a folder and a file with the same exact name?

I am trying to figure out which distro this script (scene_splitter.sh) was built for. Everytime I try to use it I get the following error. x@x-pc:/media/x/WD_2TB_HDD/test$ ./scene_splitter.sh 001.mp4 ...
0
votes
2answers
88 views

How to list all filenames in the system [closed]

I want to perform checks on all files in the system. For that I need the full paths of all files in the system. My initial idea was to do something like this: for file in $(sudo find / ); do if [ -...
0
votes
2answers
42 views

How to save a web resource, applying decoding to URL Encoded Characters?

I would like to save this file with this URL "http://pti.regione.sicilia.it/portal/page/portal/PIR_PORTALE/PIR_LaStrutturaRegionale/PIR_AssessoratoEconomia/PIR_DipBilancioTesoro/PIR_Areetematiche/...
3
votes
3answers
334 views

awk/sed part of filename

I want to awk/sed only prefix of name of files, whenever I put a filename as a parameter to my command line. For example, I have multiple files: a.fastq.gz b.fastq.gz c.fastq.gz d.fastq.gz If I ...
0
votes
1answer
71 views

How to sort files in unix

I have files in the following manner ar01440_1775_17_vc00_00.png ar01440_1775_17_vc00_01.png ar01440_1775_17_vc00_02.png ar01440_1775_17_vc00_03.png ar01440_1775_17_vc00_04.png ...
-4
votes
2answers
50 views

Finding specific string in XML file and storing in another file [closed]

Text in input file is like this <title> <band height="21" isSplitAllowed="true" > <staticText> <reportElement x="1" y="1" ...
0
votes
1answer
50 views

Hebrew (Unicode) file-name support on CentOs 7

I have a VPS with CentOS 7 installed. I am trying to upload to the server a file that has a Hebrew name. I tried to upload it via FTP (Pure-ftpd) and I get: Failed to convert command to 8 bit charset. ...
4
votes
4answers
462 views

linux find command for filenames without extension for unknown extensions

I like using the following command to print file names but it prints them with extensions. find . -type f -printf '%f\n' In my directory, there are many files with different extensions. I tried ...
0
votes
2answers
62 views

Remove part of name after regex

I have a number of video files using a naming scheme like some-words-SxxExx.extension which is my preference. Unfortunately I have a lot of files in this format some-words-SxxExx-words-I-want-to-...
0
votes
2answers
61 views

How do I find a file whose name has five digits, in a row, somewhere in the file name?

Normally, I would ask a professor or classmate this, but as it's a Saturday and everyone is gone. I have to find a file in a directory that has five digits in a row somewhere in the file name. They ...
1
vote
0answers
24 views

Convert filenames to comply with cross-platform standarts [closed]

I have lots of scientific articles on the disk that contain semicolons and other characters not so welcome on alternative platforms (even on Android via MTP). How do I automatically convert all ...
2
votes
1answer
39 views

Find a filename in a directory excluding zeros that appear in the beginning of the filename

I have a directory with file names as " 202.png, 405.png, 0052.png, 04050.png, ...... I need a find command to find filenames excluding zeros that appear in the beginning of the file name. For example ...
10
votes
4answers
1k views

Move all files NOT ending with .txt [duplicate]

In the directory /home/username/data I have both files and directories. Some of these filenames end in .txt (to which I'll refer as text files), others don't. The same happens in the subdirectories. ...
1
vote
4answers
188 views

Count the number of files and folders containing a certain string

Let's say I'm in the Desktop directory and want to count the number of files and directories whose name is exam. It should also count the files containing the string exam. So to sum it up I need to: ...
0
votes
5answers
98 views

Renaming files by extracting parts of filenames that match with a pattern

I want to know which command I can use to rename files like this. Let's say, for instance, the old filenames are: 0_predict-1-500.png 0_predict-2-500.png 0_predict-3-500.png 1_predict-1-500.png ...
3
votes
2answers
153 views

Bash - replace spaces with underscore but replace multiple spaces with one

I use rename to underscore spaces in filenames, simply with: rename "s/ /_/g" * but I encounter the problem that files downloaded from the internet often have multiple spaces. A nasty workaround I ...
24
votes
3answers
1k views

Why does awk stop and wait if the filename contains = and how to work around that?

awk 'processing_script_here' my=file.txt seems to stop and wait indefinitely... What's going on here and how do I make it work ?