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

learn more… | top users | synonyms

0
votes
1answer
32 views

Changing file name from dbf to ods problem?

I was trying to change the file name from gdf to csv in the folder using $for i in *.dbf; do mv $i ${i%.dbf}.ods; done script. The code changed all the gdf to csv, but the content of the new ...
2
votes
3answers
95 views

Convenient way to name files in Linux

I'm a beginner in Linux and want to learn to do things properly in this environment. Since the beginning I've noticed that a lot of people involved in Linux (like tutorials and guides) tend to name ...
3
votes
1answer
32 views

Mounted volume name in terminal is different from in GUI

The basic problem is that in the GUI shows a directory name with no space but when I cd to it in the terminal, the directory name has a space in it. What would cause the names to be different? The ...
1
vote
2answers
24 views

Remove all files without a keyword in the filename

I have a list of files in the following fashion: > file1.jpg > file1_orig.jpg > file2.jpg > file2_orig.jpg I want to keep all the files with the extension _orig.jpg and discard those ...
2
votes
3answers
50 views

What is the system-level effect of file permissions? [closed]

I know that r means read permission, w means write permission, and x means execute permission in the output of ls -l, like -rwxr-xr-x. But My question is what is behavior difference on operation ...
2
votes
1answer
25 views

Regarding identical copies of gedit files

When ever I save a gedit file in a directory, two copies of it get saved with identical content. Ex: If the gedit file is named as file_name and saved in Home directory then when u ls the Home ...
5
votes
1answer
921 views

How can two files in one of my folders have the same name?

I downloaded two files, they were both saved to the same filename and then I transferred them with scp to another computer. Why didn't they become one when the second was saved?
1
vote
2answers
98 views

Rename a file dynamically containing spaces [duplicate]

I want to rename a file dynamically based on data which contains spaces Name="Abc DEF" Name1="GHI JKL" mv /sample/pdf/noriginalName.pdf /sample/outputPdf/${NAME}${Name1}".pdf" But it gives me an ...
4
votes
1answer
248 views

replace all dots in filenames with underscore

I have a directory with some subdirectories with filenames and directorynames that contain some dots: $ ls -R .: dir file.with.dots ./dir: subdir.with.dots ./dir/subdir.with.dots: other.file I ...
2
votes
2answers
46 views

Names of copied files from USB device to HDD have all become uppercase. How to fix it?

I am currently using OpenBSD 5.5-release. Whenever I copy files or directories from my USB device to the local HDD, the names of the copied files have all become uppercase. What causes it? How do I ...
21
votes
3answers
2k views

How to rename file to .. (dot dot)?

Apparently you can rename file to .... If I were insane, how would I rename file to .. or .? Is such a filename even allowed? Backslash doesn't seem to disable dot's special meaning: $ mv test \. ...
9
votes
4answers
1k views

Is space not allowed in a filename?

It is said that on Unix and Linux in general, you should avoid having spaces in a filename of a file (ordinary file, dir, link, device file, ...). But I do that all the time. For a filename with a ...
1
vote
1answer
13 views

Remove GET parameters from file names in directory

I need to remove the part starting with ? from a bunch of files with names like image.jpg?foo=bar&bar=foo. Would someone please show me how it's done? These commands aren't working for some ...
3
votes
3answers
146 views

filename and pathname of a file

It is said that the filename of a file is a pointer pointing to the inode of the file. Before knowing that, I thought it was the pathname of a file that does that job. I am not sure how a pathname ...
1
vote
1answer
31 views

processing multiple extensions

I have done a script to convert recursive .jpg files to another size: echo $re mkdir "$re"_tmp for a in *.jpg ; do convert "$a" -resize $re "$re""_tmp/${a%.*} ["$re"].jpg" ; done I'd like integrate ...
5
votes
2answers
147 views

File handles and filenames

I read this post. Are file descriptors the same as file handle? While trying to configure the linux kernel, it asks open by fhandle syscalls (FHANDLE) [Y/n/?]. Why is this option provided? Does ...
1
vote
2answers
127 views

How would I change file permissions if the file name has a space in it in linux [duplicate]

I would like to know how would I rename and change file permissions of a file that contains a space in the name on Linux. Example The name of my file is: my file I have tried mv my%20file my_file ...
3
votes
2answers
32 views

How to build space separated, escaped full paths of files recursively matching glob?

I have a program which requires paths to files as arguments, which cannot be quoted and must not depend on working dir. Can this be done without chaining multiple xargs, tr, find, readlinks? Example ...
2
votes
3answers
156 views

sed + remove the first directory from path

Please advise on how to remove the first directory from a path by sed, (the inverse pf what basename does). For example echo "/mnt/VPfig/Amer/AR4/Celtel/files/COM.txt" | sed ... I should get: ...
4
votes
5answers
329 views

Bash pattern to match all files but directories

In bash, how do I specify a pattern that matches everything but subdirectories in current directory. Given that the pattern */ matches all the subdirectories, I tried (with extglob turned on): $ echo ...
2
votes
1answer
25 views

How do I get the filename received by rz?

I want to rz a file and then copy it to a different location. But I find no way to figure out the received filename in the rz help or in its man page. The rz man page, while attempting to be funny, ...
1
vote
1answer
40 views

How could I retain special character without replacing it with underscore?

I'm working on a file transfer script where I encounter a problem, when the file name look like Dr' A. The transfer script will fail due to following error: sftp> put /path/Dr'\ A.tif Unterminated ...
4
votes
1answer
27 views

batch rename files

I have multiple photo files with inconsistent name format. beach north.JPG beach south sm.jpg Bryce windsurfing sm.jpg DSC01031 1024x.jpg DSC02652 ed sm.jpg DSC03229 sm.jpg Kayak kids 2.jpg Maui ...
1
vote
1answer
42 views

Create a log file with the same name as input file

I'm new to linux shell scripting. I have few input files that I have to parse one by one. So in my "work in progress" WIP folder I have one input file at a time. While one file is under processing I ...
19
votes
2answers
780 views

Tilde (~) inside working unix directory

So, Im working in a UNIX environment and I noticed that inside my working directory, which is miles miles away from my UNIX home, there is a ~. Now, once in the past, I did rm -rf ~ from my working ...
1
vote
2answers
45 views

Problems with basename in a loop

I am new at shell script programming and I'm trying to execute a software that reads a text and perform it's POS tagging. It requires an input and an output, as can be seen in the execute example: $ ...
11
votes
7answers
646 views

Shortest way to extract last 3 characters of base (minus suffix) filename

I'm trying to set a variable in an sh script to the last 3 characters of the base name of a file (by base name I mean without the path and without the suffix). I've succeeded in doing this but, purely ...
1
vote
1answer
58 views

Forcing the system to allow me to insert any character in the file name

I had an exam this week, and one of the questions was (with one correct answer): The file name can contain the character: a) \ b) / c) ? d) ! I chose c) ? because it looked ...
0
votes
5answers
110 views

how to extract part of a filename before '.' or before extension

I have files in format below: abc_asdfjhdsf_dfksfj_12345678.csv hjjhk_hkjh_asd_asd_sd_98765498.csv hgh_nn_25342134.exe I want to get the value before the . and after the last _. The result would ...
6
votes
5answers
297 views

Renaming files with its path name

I have a .bdf file inside subfolders. All the .bdf have the same name: Loads.bdf Example: /home/user/folderxx/folderxxx/Load.bdf /home/user/folderxx/folderxxx/Load.bdf I need to find (and copy to ...
1
vote
2answers
71 views

tar compression without directory structure

Under my current directory, I have two sub-directories: dir_1/ - file1.png - file2.png ... - fileN.png dir_2/ - fileA.txt - ... - fileZ.txt When I tar compress the two ...
1
vote
1answer
69 views

Globbing with * in Bash - Debian vs RHEL [closed]

Where is the difference? Do these distributions handle globbing differently? Platforms: Debian Wheezy 7, Red Hat Enterprise Linux 7. Bash is always used. In my example, cat prints every file in /etc ...
3
votes
2answers
364 views

Extract file name from path in awk program

I have an awk script and I have passed a CSV file to it. awk -f script.awk /home/abc/imp/asgd.csv What am I doing is to get FILENAME within script.awk. FILENAME gives me the whole path. As I am in ...
0
votes
2answers
42 views

How to create a variable $ldir at your home directory that contains the relative path to letters?

If there's a directory on your Desktop called letters: 1) How to create a variable $ldir at your home directory that contains the relative path to letters? 2) How to copy a text file f1.txt to the ...
3
votes
1answer
80 views

How to find all paths not compatible with Windows?

On most Linux filesystems, NUL (\0) is the only invalid character in paths (and / is reserved as the path separator). Windows has a complicated set of rules for valid paths. Rather than fixing paths ...
1
vote
3answers
85 views

Copying the full path of a file to text file

I want to get the full path of all files in a directory and and the entire path has to be saved in one text file. Can you give me the script for that?
4
votes
1answer
90 views

mapping a split file to /dev/loop0

I have a iscsi disk 2TB large. I make backup of that disk every week. The backup script copies the image of the whole iscsi disk into a file on my NFS. Unfortunately, it does not copy the image in one ...
1
vote
1answer
430 views

Using EXIFTool to add EXIF data from filenames

There is a set of photos with timestamps in their filenames like these: Photo on 3-09-12 at 9.24 PM #2.jpg Photo on 3-09-12 at 9.24 PM #1.jpg Photo on 3-09-12 at 8.23 PM.jpg etc. ("3-09-12", ...
2
votes
3answers
68 views

Make grep work for special filenames

I have a set of txt files whose names may contain space or special characters like #. I have a grep solution grep -L "cannot have" $(grep -l "must have" *.txt) to list all the files who have must ...
2
votes
1answer
40 views

How to list files in a zip without extra information

en I use unzip -l test.zip I get the output like this: Archive: test.zip Length Date Time Name --------- ---------- ----- ---- 810000 05-07-2014 15:09 file1.txt 810000 ...
5
votes
6answers
580 views

About the .file and ./directory confusion

This is a dumb question, but I recently moved from windows to linux, and I see one strange thing: ./configure or nano /something/something2 Is this something2 a file? It looks like a directory, ...
-1
votes
1answer
60 views

What does ~ mean at the end of a file name (e.g. httpd.conf~)? [duplicate]

I edited a fresh apache config file in CentOS 5 using gedit. When I looked at the directory I saw now two files: httpd.conf and httpd.conf~ What does the ~ signify?
-1
votes
2answers
79 views

Split files and rename the files

I need to split a large file into 5 pieces and rename them. For Example, file Test needs to be split into Test1, Test2 & Test3. However, the split command splits as xaa,xab,xbc.
-2
votes
2answers
52 views

changing the names of files within a directory [duplicate]

I have few files under a particular directory. These are the files idex.1.ebwt idex.2.ebwt idex.3.ebwt idex.4.ebwt idex.rev.1.ebwt idex.rev.2.ebwt I want to change the names of the file from ...
1
vote
2answers
2k views

How do I get absolute path from using find unix command

How to get absolute path by using find command. actually I am running the following script:- find . -size +20M | while read a do i=$(echo $a | sed 's:/: :g') echo $a; j=($i) ...
3
votes
2answers
203 views

Path syntax rules

I'm writing a library for manipulation Unix path strings. That being the case, I need to understand a few obscure corners of the syntax that most people wouldn't worry about. For example, as best as ...
2
votes
1answer
30 views

What is the meaning of '.' in the cpio file

This is my the content of my rootfs.cpio file: [root@xilinx output]# cpio -idv < rootfs.cpio . init dev dev/console 1149 blocks What is . here ?
4
votes
7answers
526 views

How to split a filename list in 5GB sets?

I have a pretty big list of files which I like to group in smaller list of 5GB each for further processing. The file list is in the following form: "size" (from du) "tab" "absolute path", like this ...
2
votes
2answers
110 views

Shell Scripting: how to use part of the file path as the file name?

I have a group of directories, each containing exactly 1 jpeg image, like so- /psds/folder1/image.jpg /psds/someotherfolder/picture.jpg /psds/yetanotherfolder/thumbnail.jpg What is the appropriate ...
3
votes
3answers
105 views

Change the name of a file that contains spaces in the name

I don't know why but when I go to change this file name with mv command it comes up with the error stating not a directory. -bash-4.1# mv {{ THEME SANITIZED }}.hacks.css myomega.hacks.css