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

learn more… | top users | synonyms

3
votes
1answer
165 views

How can there be a directory named `~`?

I was trying to test out this buggy/new tool to see how it works, and it prompted me to choose a directory to use for stuff I am doing. From the directory ~/Code/indep, I typed in ...
5
votes
1answer
263 views

Variable in sed

I have a file that contains filenames with absolute path. In the middle of that path, is a variable directory, whenever I hard code the variable part, it works fine, but when I replace it with the ...
2
votes
1answer
16 views

zsh: how to get file expansion working in print statement

I have the following code which prints recursively all files inside /usr/local/include: % files=(/usr/local/include/**/*(^/)) % print -l $files Is it possible to get rid of the temporary variable? ...
3
votes
4answers
472 views

How to prepare files for rsync on a case insensitive filesystem?

I am transferring a large number of files on a HFS+ filesystem. The files are currently on ext2 partitions. I have conflicts due to case insensitivity of the target partition (HFS+). I want to ...
1
vote
1answer
310 views

rename multiple files recursively and remove multiple characters such as ? : or newline from names

I have seen a few similar questions, but nothing that shows how to remove any of a set of special characters from all file names recursively. I want to keep uppercase and lowercase letters, numbers ...
0
votes
2answers
264 views

Making md5sum understand file names with spaces

I need to use md5sum in Python by using pipe to calculate checksum for a bunch of .mp3 files... is there a command which ignore whitespaces in filenames on the command line of md5sum program? For ...
3
votes
1answer
104 views

Test for link with trailing slash?

I created in /tmp/test/ mkdir somedir ln -s somedir/ somelink I want to loop through only directories: for file in */ ; do if [[ -d "$file" && ! -L "$file" ]]; then echo "$file is a ...
2
votes
1answer
218 views

Merging folders with practically the same name but different casing

When digging around in the advanced settings in Dropbox I lost a folder. I only discovered this about a month later. I managed to get this folder back from Dropbox however the file structure of the ...
22
votes
3answers
617 views

shellcheck is advising not to use basename: why?

I am trying out shellcheck. I have something like that basename "${OPENSSL}" and I get the following suggestion Use parameter expansion instead, such as ${var##*/}. From the practical point of ...
1
vote
3answers
170 views

splitting the string in bash script

I am new to bash script. I am taking some input from user and checking details about that. Example: $HOME/Documents/test/one.txt I take the above string as an input and want to retrieve one.txt, I ...
1
vote
3answers
661 views

fsck -cc /dev/sdb1 gives this result. Is everything okay?

root@host [/]# fsck -cc /dev/sdb1 fsck from util-linux-ng 2.17.2 e2fsck 1.41.12 (17-May-2010) Checking for bad blocks (non-destructive read-write test) Testing with random pattern: done /dev/sdb1: ...
7
votes
1answer
220 views

Why do *nix filesystems support file names with newlines? [duplicate]

According to this page: File names in Linux can contain any characters other than (1) a forward slash ( / ), which is reserved for use as the name of the root directory (i.e., the directory that ...
2
votes
1answer
93 views

Symlink with @ symbol?

I found that there is a symlink generated by ruby which has a @ sign at the path: default -> /Users/MyUserName/.rvm/rubies/ruby-2.0.0-p247@gemset The folder ...
0
votes
1answer
2k views

Why does scp say “No such file”?

I have a bash script that uses scp to copy a file from my machine to another. The script keeps on exiting after I enter the SSH password with the error: <filename>: No such file or directory ...
1
vote
5answers
2k views

Find files by the length of filename

I want to find all files by length of the file names. For example if I want to find files of length 1, such as a.go, b.go I put: grep '.\{1\}' file But this does not work. What command can I use ...
1
vote
2answers
571 views

Way to write new filename on wildcard input?

I have some experience with Inix terminals from science internships I've been part of, mainly using a few utilities like grep, awk, and sed but there is one thing I've been trying to figure out for a ...
3
votes
3answers
395 views

Command for taking a screenshot to a new file

I want to configure a global hotkey to take a new screenshot and save it, say, somewhere inside my home folder. I can take a screenshot with ImageMagick with this command: import screenshot.jpg ...
1
vote
4answers
698 views

Write output of wget or curl to a custom filename based on the url

For example I have a link http://www.abc.com/123/def/ghi/jkl.mno. I want to download it using wget or curl and get the name of output file as def_ghi_jkl.mno, where the part def_ghi is taken from the ...
8
votes
3answers
428 views

Select unicode filename in Bash

Ok; suppose I'm in Bash and I have several files in a folder. Several of them are named file☠☡☢☣.txt, where ☠☡☢☣ starts with crazy untypable unicode characters. How would I refer to one of them? ...
3
votes
2answers
61 views

Is there a way to condense ../.. parts of a path out programatically?

Say for example I have these types of paths to files in a script: /path/to/some/file/../../file1.txt Is there a command I can call such as readlink that will convert this path to its actual ...
7
votes
3answers
568 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
735 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
294 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
451 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. ...
2
votes
1answer
293 views

Given a mime-type get the corresponding file extension

I want to download I 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
525 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
177 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
89 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: ...
3
votes
1answer
10k 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
380 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
292 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
3k 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 - ...
1
vote
1answer
1k 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
209 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
971 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
246 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
432 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
199 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
1k 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
170 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
51 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
253 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
1k 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
2k 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 ...
-4
votes
1answer
66 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
60 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
67 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, ...