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

learn more… | top users | synonyms

7
votes
3answers
639 views

Generate new name for moved file to prevent overwriting?

How can I generate a new name for a file if there's an existing file With that same name? In a Desktop environment a new name is generated my appending a number to the end of the file name, but how ...
3
votes
2answers
959 views

Why are filenames that start with a dot hidden? Can I hide files without using a dot as their first character?

Initially I thought it was a coincidence, but now I see there's even a tag for it: all hidden file names start with a dot. Is this a convention? Why was it chosen? Can it be changed? Or in other words ...
1
vote
1answer
331 views

How can I custom rename podcasts after downloading them with gPodder?

I'm using Arch Linux. To download podcasts, I use gPodder 3. To listen to my podcasts, I'm using Rockbox on my iPod Classic. The thing is, the podcasts don't get sorted nicely on my iPod: ...
3
votes
1answer
549 views

How can I sort a list of file names by some substring of the name?

I have a number of files with names like: beginning_num1_734_num2_1.363e+12_num3_800.pdf beginning_num1_735_num2_7.453e+13_num3_800.pdf beginning_num1_1007_num2_9.453e+12_num3_1200.pdf I'd like to ...
0
votes
1answer
59 views

Get the most recent backup files [duplicate]

I'm googling for this, but the terms are so generic I'm getting way too many false positives, so what the hey, I'll ask here. I'm sure there's a simple answer but I don't generally script in *nix. ...
3
votes
1answer
366 views

Given a mime-type get the corresponding file extension

I want to download a file using curl to a temporary directory with the appropriate extension. Currently I do something like this: tmp="$(mktemp -t 'curl')" curl -o "$tmp" ...
3
votes
3answers
655 views

How to find file/directory names that are the same, but with different capitalization/case?

How can I list the file/directory names in a directory recursively that are the same, but with different capitalization/case? ex.: INPUT (not the ls command, the directories): [user@localhost ...
3
votes
1answer
192 views

How to create a file with the name specified in ASCII encoding?

I want to create a file that is called ascii 007, which is the bell symbol, which is not printable. I tried nano $'\007', but that just created a file called ?; cat ? print the test content, that I ...
2
votes
1answer
105 views

find doesn't return expected files

I'm doing a search for files that contain ".anki" in their file name. root@t500:/home/some1# find / -name .anki /home/some1/.anki But there are other files in my home folder that contain .anki: ...
5
votes
1answer
13k views

cp: cannot stat `/vol/examples/tutorial/science.txt': No such file or directory

I tried a command cp /vol/examples/tutorial/science.txt . and I get the error - cp: cannot stat `/vol/examples/tutorial/science.txt': No such file or directory I don't understand why this is ...
6
votes
3answers
393 views

How do you create a file with an empty name?

I don't know how, but I created a file with an empty file name, I doubt there was a whitespace there (I'll explain why at the end): chaouche@karabeela /mnt/ubuntu/storage $ ls total 352K drwx------ ...
1
vote
1answer
378 views

Trouble with mv and adding the date

I want to be able to move $oldfile to my backup folder and add the date to the file name. So I tried this... mv $oldfile /home/u0146121/backupfiles/$oldfile_$(date +%F-%T) This just gives me this ...
1
vote
1answer
4k views

Adding a time stamp when moving a file in bash [duplicate]

#!/bin/bash while read server <&3; do #read server names into the while loop if [[ ! $server =~ [^[:space:]] ]] ; then #empty line exception continue fi echo "Connecting to - ...
2
votes
1answer
2k views

Executable symbolic link file not working

On Mac OSX, I am having trouble with a pretty simple thing. My symbolic link doesn't want to execute. Can you help me spot the trouble? Thanks! $ echo $PATH ...
2
votes
2answers
228 views

how to copy and rename files with “:” and incrementing number in the filename

I need to copy and rename (and then edit) a group of files in the /etc/sysconfig/network-scripts folder. The files are ifcfg-eth1:* I have ifcfg-eth1 through ifcfg-eth1:121 but need to extend with ...
2
votes
3answers
1k views

Need to trim the names of file names

I have files in UNIX directory which have a unique number starting with, i have to remove the unique id followed by '-' from the file name and need to have regular file. Any help is appreciated. ...
3
votes
2answers
258 views

How can I use aliases in commands?

I have created aliases in my .bashrc for various frequently used long paths but I can not seem to be able to use them inside vim or with commands such as find or grep. E.g the following: db in cli ...
0
votes
2answers
552 views

passing filename with spaces to a shell script [duplicate]

The shellscript is very simple: retroarch $* -c /tmp/retroarch/Data/retroarch/gambatte.cfg ("retroarch" is another shellscript) If the filename passed contains spaces it fails: RetroArch [ERROR] ...
4
votes
5answers
203 views

Standard unix util to split “foo.bar.baz” into “foo.bar” + “.baz”?

I want to split a string $basename, containing the output in two parts, $stem and $ext, such that: the string "${stem}${ext}" is identical to the original string $basename; either $stem or $ext may ...
2
votes
2answers
2k views

How to find files by the time in their filename? [duplicate]

We have a directory contains files which contains time in their filename ./test.2013-06-11_06-01.gz ./test.2013-06-12_01-01.gz ./test.2013-06-13_03-01.gz ./test.2013-06-14_03-01.gz ...
3
votes
2answers
192 views

Wget with different filename, but same extension

I need wget to save to a different folder, different filename, and same extension, but I do not have the filename before downloading. For example, let's say I have: ...
2
votes
1answer
54 views

Parse a dragged path from a remote machine

I am writing an application that needs to be able to parse a path that is dragged from a remote server onto the command line. However, when I drag a path from a remote machine to the terminal I get ...
2
votes
3answers
1k views

Replace filename with parent folder name

I have a bunch of files each in their own subdirectory. I need to write a script to rename each file to have the same name as its directory: For example, given: ./1111/1234.pdf ./2222/2345.pdf ...
2
votes
1answer
268 views

Canonical paths: why are they needed?

The issue of resolving symlinks (symbolic links) is often addressed on this forum, and on others. Related are the concepts of relative, absolute (or full), and canonical (or resolved) pathnames. Two ...
12
votes
6answers
2k views

Portable way to get script's absolute path?

What is a portable way for a (zsh) script to determine its absolute path? On Linux I use something like mypath=$(readlink -f $0) ...but this is not portable. (E.g., readlink on darwin does not ...
2
votes
2answers
3k views

What does the tilde (~) mean at the end of a filename? [duplicate]

What is the file with the ~ at the end of the filename for? $ ls # aliased to add flags -rwxrwxr-x 1 durrantm 2741 May 16 09:28 strip_out_rspec_prep_cmds.sh~* drwxrwxr-x 13 durrantm 4096 May 16 ...
-3
votes
1answer
67 views

How to copy datasets from prior version directory to latest version directory [closed]

I've go a number of directories named like: /data/db/OX/8_10 /data/db/OX/9_1 /data/db/OX/9_2 And need to copy some files (all the pt.* files) from the second latest one (above 9_1) to the latest ...
0
votes
2answers
61 views

Comparison of forbidden symbols and names in different FS's

What symbols and (maybe) names are forbidden on different files systems available in modern Linux distribution?
38
votes
2answers
2k views

Why do some Linux files have a 'd' suffix?

I am new to Linux. I observed some of the binary files and configuration file name s end with a d. What is reason for putting a d at the end of the file name? Like httpd, ospfd, pppd, syslogd, ...
0
votes
1answer
79 views

Searching for multiple files and changing file extension [duplicate]

I want to search and identify multiple files, within a directory, having a particular file extension (.txt) and changing the extension to (.fasta). This is considering not changing the file itself, ...
1
vote
6answers
3k views

File extensions and association with programs in linux

In windows we can associate a file's extension with programs. E.g. a file test.pl can be run by the installed Perl interpreter due to the pl extension. In linux though it needs #!/usr/bin/perl as the ...
2
votes
3answers
115 views

Filter a list of strings using math

I have a directory with files listed like so: abc201303130110.txt abc201303140511.txt abc201303150112.txt As you can see, the filename contains a datetime stamp. I want to return all files with the ...
4
votes
1answer
118 views

Using '@' for a directory name

Though Unix/Linux will technically allow any character in file and directory names, using punctuation is almost always fraught with peril due to the extensive use the O/S makes of punctuation for ...
2
votes
5answers
249 views

move a directory with a single character (back quote) as its name [duplicate]

How can I move a directory whose name is just a space? ls -lah drwx------ 4 user1 user1 8.0K Mar 13 14:16 . drwxr-xr-x 3 root root 60 Mar 13 13:48 .. drwx------ 18 user1 user1 4.0K Mar 13 11:18 ...
1
vote
1answer
245 views

How to prevent double escaping?

I'm trying to put a bunch of images together into a pdf. I ran gm convert *.jpg out.pdf and it worked, but the images were not in the right order. I found that ls -v orders them correctly so then I ...
5
votes
3answers
145 views

Filtering redundant paths from a list of paths

I have a list of relative paths such as this: dir1 dir2 dir2/dir3 dir2/file1 dir3/file2 dir3/dir4 dir3/dir4/file3 In the example above, the specifier dir2/file1 (for example) is redundant, because ...
6
votes
4answers
731 views

Files with empty names

I was writing a widget for displaying files in a given directory and I wondered whether I need to cover the case where a file has an empty name. Testing showed not obvious results, so I was ...
1
vote
2answers
3k views

Synchronizing same files with different filenames using rsync [duplicate]

I have a directory ~/music that contains all my music files and a directory /media/backup/music that I wish to synchronize with the first one using rsync. Initially, I did a rsync -a ~/music ...
1
vote
3answers
477 views

Reading a directory in shell script

I want to read a numbered directory which is under a path, into a variable in shell script. The paths are something like this: .../releases/R1/... .../releases/R2/... .../releases/R3/... Each time ...
8
votes
3answers
464 views

What are ./ and ../ directories?

Simple question, but I'm not sure where to look and google doesn't respond to periods and slashes. I'm just trying to count the # of files & directories in the current directory (not including ...
1
vote
2answers
175 views

How to “grab” matching files from a lookup file in bash?

I have a lookup file containing filenames. I also have a directory containing files, some of which have the names that correspond to some of the names in the directory. How can I: Move exact ...
7
votes
1answer
430 views

What is the significance of the dot in bash commands and how is it different from an asterisk?

I'm trying to understand the significance of the dot in bash and how it differs from an asterisk. Can someone please elaborate? For example, what's the difference between cp -ar /foo/. /foo2/ and cp ...
3
votes
1answer
102 views

Symbolic link starting with .#

I have a symlink in one of my directories that has the following name: lrwxrwxrwx 1 XXXX ZZZ 37 Jan 15 18:18 .#perl.org -> XXX@YYY.com.2980:1344441539 I am wondering what this symlink ...
1
vote
2answers
2k views

Command to find file/path lengths that are too long for burning to DVD?

I'm trying to burn a DVD from Windows but it fails because the full path name length exceeds the limit of something like 255 characters. Our files are stored in Debian Linux (accessed by Windows ...
5
votes
3answers
3k views

Bash script that reads filenames from a pipe or from command line args?

I want my script to read a bunch of filenames (which may have spaces) given either as a glob or from STDIN and do stuff with them. I've been able to read either way separately, but not combine them. ...
3
votes
3answers
1k views

How do I remove carriage returns from directory names?

I created a file in Excel and ftp'd the file over to my Linux machine. In the file were a bunch of mkdir commands. Now all of the newly created directories have a carriage return at the end of them. ...
0
votes
2answers
170 views

file command + how to view all results from file command

I use the file command in order to verify if file (PATH) is text/ascii file or encrypted file Because file command have allot of results ( small example in example 1 ) I want to get the all ...
5
votes
2answers
3k views

Manipulate file name piped from find command

I'm relatively new to Bash and am trying to do something that on the surface seemed pretty straightforward - run find over a directory hierarchy to get all of the *.wma files, pipe that output to a ...
0
votes
1answer
574 views

setup filename encryption for encrypted home folder in eCryptfs

I used ecryptfs-migrate-home to encrypt my home folder on my Debian (Testing) system. As I am a complete encryption-greenhorn, I don't know yet how to check, if the encryption succeeded. However, I ...
0
votes
3answers
2k views

How to match a file name suffix

How to verify if the name of a .xml file name ended with .any-string? e.g. .previous or .backup or bck12 etc ... I need to print the XML file name except for XML files that end with ...