Stack Exchange Network

Stack Exchange network consists of 174 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.

1
vote
0answers
46 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
35 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
14 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
22 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
39 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
142 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
21 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
38 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
69 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
37 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
236 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
55 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
45 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
19 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. ...
3
votes
4answers
270 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
40 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
55 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
23 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
38 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
104 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
94 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
69 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 ...
23
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 ?
0
votes
1answer
35 views

Reading full Names in an Archive or ISO image?

I recently installed Ubuntu 18.04 on my Laptop wanting to learn Linux. I have some Video Courses in ISO Images; whenever I want to extract files from them, I don't get full names for some reason. I ...
1
vote
1answer
137 views

Linux grep for file starting with certain letter AND contain certain words

Trying to search a file directory for file names beginning with "h" and containing "enu"? So far this is what I've got, I just don't know how to handle both grep statements in one command line? find ...
1
vote
1answer
34 views

Remove files in linux with different folder files to delete in a folder as particular folder

I want to remove multiple (all) files with different suffixes (.log,.bin) in a particular directory (/home/username) in a one-line command. How could I do that?
0
votes
2answers
50 views

Want to edit a file content for Removing the string after the last underscore and before the file extension using Unix commands

I want to edit the file contents in the 2nd row and 2nd column ,which is a file name from that I want to remove the part after the last underscore and before the file extension . The contents of the ...
0
votes
1answer
43 views

Rename multiple files using sed command after removing the string after the last underscore [closed]

I have a set of files in a directory as shown below and I want to remove the string after the occurrence of the last underscore from it. The string may be different each time. It will be good if it ...
1
vote
3answers
63 views

Sorting filenames uniquely

I have searched for the solution but couldn't find answer to my problem. I have thousands of file in a directory. Filenames are in the below format 74687_1543944930857.txt 74687_1543945090451.txt ...
0
votes
1answer
56 views

Check that 2 arrays of file names are the same

So I have the following: cat file | grep -E regex which gives a list of lines Now I also have a for loop the produces a list of files So it is like I have 2 arrays. But how do I check in bash if ...
0
votes
2answers
86 views

Rename Files to Same Filename Without Extension with find Command

I'd like to rename a group of files to their same filename but without extension. They are scattered in my home directory and I don't know where they are located precisely, but I do know the extension ...
0
votes
2answers
60 views

How can I change lower to upper using (three) parameters in bash? [closed]

I have to make a bash script that will be changing files' names from lower to upper OR from upper to lower via parameters in command line. So when I put in command line: ./bashScript lower upper ...
0
votes
1answer
56 views

Eliminating multiple-extension file names from find output

I need to find the size of all files in /etc with the .conf extension. I tried to do this with find /etc -type f -name "*.conf" -exec du -chB1 {} +, but find gave me .conf files that have two or three ...
0
votes
2answers
37 views

delete then rename: same filenames different extensions

I have a directory containing thousands of files, each file has a duplicate. An example: file1.txt file1.jpg.txt file2.txt file2.jpg.txt I want to delete all *.txt files, and leave the *.jpg.txt ...
2
votes
1answer
59 views

Why does crc32 say some of my files are 'BAD'?

I used crc32 to compare some files with a backup of them. Out of 3556 files, 11 were reported as 'BAD' as in the following example: 9be46354 ./9836Feeding_the_dog_.mpeg BAD 9be46354 != ...
-1
votes
1answer
42 views

Rename files on QNAP linux (batch)

I have a folder with at least 30 files. The names are: 123456_12_12_AB12_NAME.mp4?BWSQv6seywG5ND2Myt7YM3JHPmaaNmtBRI0PcXbYpqoS01ivTvL0HCHvjfjFtOM9AMq7-kpHUZ0W_m8njEjqBkM9uyngsnKANw How can I get ...
-1
votes
1answer
34 views

using sed command to get after a /

I want to use sed for extracting the file name after the last occurrence of /. For example /usr/bin/file.txt and the output should be file.txt
6
votes
3answers
790 views

Remove files that start with but don't contain

I'm trying to remove a lot of files at once but need to be specific as to not remove any of the files I actually need. I have a ton of corrupt files that start master- but there are valid files that ...
0
votes
1answer
42 views

Use negate ^ to get results which not contain specified charactres

I want to grep the files whose name not containing "^iX500" $ cat note_list ... /Applications/ScanSnap Manual.localized/iX500ScanSnapManual.app/Contents/Resources/manual/basic/EN/ix500/images_mac/...
-2
votes
2answers
34 views

Handling whitespace in filepaths

I have this: muh_dir=`cd $(dirname "$BASH_SOURCE") && pwd` and yeah I tested the above (it has backticks) and it doesn't work well with whitespace in the pwd. On the other hand, this is ...
0
votes
1answer
91 views

How to find the filename without path?

Currently, I have a function to find the filename, size and type; however, it includes the path as well, which I don't really need. find . -type f -exec stat --format="%n %s %F" which returns ...
-1
votes
1answer
52 views

Create a folder with all possible combinations of characters and numbers [closed]

I want to create a folder like "example.txt, example.Txt, example.TxT... all possible combinations.
0
votes
1answer
33 views

convert a md file in odt with correct name

I added this command in Dolphin menu for convert a .md (Mark Down) file to .odt (Open Document Text ) file: pandoc %U -o %F.odt and I get the right file, but with two extension: fileorig.md.odt ...
1
vote
2answers
86 views

How to match a file name by specifying a prefix substring?

I would like to copy the files, located on a remote machine, whose filenames match a prefix string, on my local machine. I have tried to select only the files whose names start with either massif or ...
0
votes
1answer
47 views

ls: ordering by timestamp (reversed) and if the timestamp is the same order by name (not reversed)

I'd like to order a directory by reversed timestamp, but if the timestamp is the same order by name (not reversed) Using ls -tr if two files have the same timestamp order by name but in reversed mode
-2
votes
1answer
100 views

Space after filename (Linux) [closed]

Whats different "name.txt" vs "name.txt " in Linux? If I rename name.bin to name.txt - is normal and file doesn't executable. If I rename name.bin to file.txt (with space after filename) - file ...
0
votes
2answers
105 views

find specific files and copy them to a directory in linux

abc-1.0.zip kncb-1.0.zip jenk-1.1.zip I want to find all the above files dynamically and copy them to a directory except jenk-1.1.zip. I have tried the below command but it also copies file(jenk*....
0
votes
1answer
18 views

Filter file to list all paths in it

How can I filter text file to remove every thing and just leave the paths in it? For example: dslkjcblasdjncklasdnlc /asdds/ads/adss/sdf.jpg asljdascuashn sdkm /sdf/dsf/dsf/dfs/sdfs.txt ,nbaskhdnasm....
0
votes
1answer
42 views

Tag files based on file name if no Title metadata exists

Is there a way using the command line to automatically fill in empty "Title" fields of the tags of music or videos with the file name? I have tried using Beets, but the only way to tag things based on ...