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

learn more… | top users | synonyms

29
votes
4answers
3k views

Is slash (/) part of the name of Linux root directory?

Is the slash (/) really part of the name of the Linux root directory? Or is it just a symbol for it? What about /etc and so on?
0
votes
0answers
31 views

No such file or directory: But file exists [closed]

I am stuck in a very weird problem. I have a Bash script in a server A which is called from server B using another script. The script from server B returns "No such file or directory". The file is ...
1
vote
2answers
75 views

Copying to USB drive modifies filename

I have a bash script which copies data across to a USB stick. It works. The data is copied across fine, but the filenames are always changed. They are the same as they were before, but any longer ...
1
vote
0answers
23 views

convert windows path to unix path inside wine application command line

I'm running a windows application in wine, which executes configurable commands to run external applications (e.g. an diff editor to show differences between two source files). So these commands are ...
3
votes
2answers
26 views

Extract parts of csv filename in columns

I have a set of .csv files in a directory, say abc_q1_w1.csv defg_q11_w2.csv hijk_q11_w3.csv I want to write a script that extracts parts of the filename and put them in columns, i.e abc q1 ...
1
vote
2answers
49 views

Find files with pattern and get latest one

I want to find file with specific pattern and print the latest file matching the pattern with full path find ../*.gz -type f -print0 | sort -nr | cut -d: -f2- | head -n 1 How do I print the full ...
1
vote
3answers
75 views

Extract filename from another filename

I receive notification files for different files. I want to extract the filename from these notification files which I would use in another process. The first 4 strings of the notification file will ...
1
vote
0answers
37 views

incrontab on folder name containing line feeds

I'm writing a script searching for directories in a subtree and appending them to incrontab. I can even add folder names with blanks by escaping those with a backslash: /path/to/observed\ directory ...
1
vote
2answers
89 views

How to zip directory with encryption for file names?

Using command line, I know that I can encrypt a directory with the following command: zip -er Directory.zip /path/to/directory However, this does not encrypt the filenames themselves. If someone ...
1
vote
1answer
37 views

How to find files their names, name of files are in one file?

I know how to find and concatinate pdf file. I did with the follwoing code. pdfunite *.pdf output.pdf But the problem is I have list of file names in one file say filenames.txt and I would like to ...
1
vote
2answers
70 views

Bad substitution trying to rename extension [duplicate]

I'm trying to convert all wav and mp3 files to ogg files recursively with find and FFmpeg. I have made the following bash script to do so: #!/usr/bin/env bash # Converts samples to ogg find samples ...
2
votes
2answers
43 views

Command to print content before a symbol (last character in a line)

Let's consider I have 3 files: abc_def_12345.zip abc_123.zip abc_def_ghi_3432.zip I want to print only the characters before the last underscore(_) The expected output is: abc_def abc abc_def_ghi
0
votes
1answer
40 views

Can't remove apostrophes from filenames in terminal [duplicate]

I don't understand why zsh and bash (ls) show me lots of filename inside apostrophes, but not all: 'joe rilla - mauern fallen.mp3' jokaz-alarmbereit.mp3 'yoshi blessed - everybody free.mp3' I tried ...
3
votes
0answers
18 views

Archive Manager doesn't show file with the name “-”

Given that I made a .zip file by piping from stdin like this: $ echo foo | zip temp.zip - This produces an archive OK (with the data in a file named "-"): $ unzip -t temp.zip Archive: temp.zip ...
2
votes
2answers
53 views

add a file name to lines in this file

I have fasta files, coming from different samples eg: 01.fasta, 02.fasta, etc. All of them contain OTU list with the following pattern: >OTU1 CCTACGGGCGGCTGCAGT >OTU2 CCTACGGGTGGCTGCAG I ...
0
votes
2answers
31 views

Listing numbered files using wildcard sequence with predefined range

I have a folder of numbered data files. I am trying to incrementally extract a predefined range of files. The range of files that I am looking for is predefined in two variables, ns and ne, which ...
1
vote
2answers
71 views

Extract zip files into directory based on pattern of zip name

I have these zip files: PLP_633555_2015-03-04_01-12-01.zip PLP_634562_2004-03-02_02-15-07_UBIC.zip PLP_563462_2008-05-02_01-21-03_UBIC_STOC.zip And I need each zip extracted into its appropriate ...
1
vote
2answers
55 views

Nautilus: How are files sorted?

I am quite new to Debian 8.4. I am not sure if this is the right community on stackexchange to pose this question. Please tell me, if not. My question: I am using the Nautilus file manager. I view a ...
4
votes
3answers
315 views

Remove files by regular expression

I want to keep files whose names match [0-9A-Z]{1,2}_\d{4}_\w+?\.dat, for example, A1_2001_pm23aD.dat, K_1998_12.dat, and remove the rest. However, the ls and rm commands do not support such regexes. ...
0
votes
2answers
47 views

How to search for Viber app files

I am trying to perform filesystem extraction on viber app. my findings show that viber contains a folder named databases which contained files of interest, namely, Viber_messages, Viber_data and ...
1
vote
1answer
73 views

passing ls variable to grep when doing a file search only works inside directory

I am running a command that I use to find the most recent file in a folder then grep the contents for a matching pattern. Here is the command flow that shows the problem I am having. root@backup /]# ...
0
votes
3answers
77 views

How do I remove a dot dollar no name directory

I have this weird directory in Oracle Linux that I cannot remove, cannot change owner, cannot change group, etc. It seems to be an environment variable that is empty and is named: .$EXTEND Here's ...
0
votes
0answers
47 views

find awk log print error

I'm trying to find one year old directories named in yyyymmdd format and print it in the log file placed at different location. find ${LOG} -maxdepth 1 -type d -mtime +${DAY} -name '20[0-9][0-9][0-9][...
2
votes
4answers
129 views

How to delete a tilde (~) folder? [duplicate]

I need to delete a "~" folder in my home directory. I realize now that rm -R ~ is a bad choice. Can I safely use rm -R "~"?
2
votes
1answer
46 views

Change to a directory containing a space

I'm using a MacBook with OS X installed. I'm on Terminal trying to go to a directory. So I'm in Home and I use the command ls and there is a VirtualBox VMs directory. But when I try to do cd ...
3
votes
1answer
107 views

Is there a way to use regex expressions to auto-fill filenames in bash?

Assuming I have a directory with files as shown: $ ls file0001.txt file0002.txt file0003.txt file0004.txt file0005.txt someotherfile.txt Lets say I want to run the following command: $ cat ...
1
vote
0answers
22 views

How to remove a single quote from a file name? [duplicate]

I have some podcasts on my radio server which contain a timestamp when they should be played. I noticed one of them is put into single quotes 'filename.mp3', and I'm unable to remove them. Check this: ...
0
votes
2answers
82 views

Are periods (“.”) valid characters in file or folder names? [closed]

I would like to name my files and folders according to a specific date, e.g. 03.04.2016. I see I can use them but are there any disadvantages to using periods in files or folder names?
2
votes
0answers
33 views

Producing the next available filename for a pattern (02-output.log etc)

I can use mktemp(1) within a shell script to make a temporary file in a directory with a suitable suffix & prefix. Is there a command that, given a pattern (e.g. NN-output.log) will look for 01-...
1
vote
2answers
26 views

How prepend appropriate amount of 0's to numbers contained in image names?

I've got a folder /User/me/Desktop/folder/images with files like key 1--name.jpg, key 10--name1.jpg, etc. The files are sorted incorrectly when fed to my site so I get an arrangement like key 84--name....
1
vote
3answers
52 views

Get directory name from file name

I want to make a directory name by extracting parts of a file name. Here are some examples: server.log.2016-03-20-14 → 20160320 server-2016-03-17-13-16-Restart.log → 20160317 I'm using HP-UX.
0
votes
2answers
57 views

Transforming a list of files separated by new lines into a variable

Goal: I'm trying to find all instances of *.clj or *.cljs files recursively within a directory, store them in a string variable (separated by new lines) and then transform them. So if the following ...
3
votes
2answers
167 views

Why the defined path is used as file name when I transfer files through scp to a Windows host?

When trying to copy a file from Linux (Raspbian to be precise, though I don't think it matters) to Windows using SCP: scp a.txt {user}@{ip}:\C\Users\{user}\a.txt The file is copied, but to C:\Users\...
1
vote
1answer
52 views

Characters best avoided in filenames when used in Bash, e.g. `?`

For example: $ ls -l total 344 -r-------- 1 t t 145657 Mar 11 01:53 joeltest-slides.pdf -rw-rw-r-- 1 t t 166814 Mar 11 01:55 The Joel Test: 12 Steps to Better Code? by Joel Spolsky.pdf drwx-w--w- 2 t ...
22
votes
8answers
2k views

Clipboard for copying and pasting files in command line?

In Bash, suppose I visit a directory, and then another directory. I would like to copy a file from the first directory to the second directory, but without specifying the long pathnames of them. Is it ...
12
votes
5answers
967 views

How to list all files in a directory with absolute paths

I need a file (preferably a .list file) which contains the absolute path of every file in a directory. Example dir1: file1.txt file2.txt file3.txt listOfFiles.list: /Users/haddad/dir1/file1....
3
votes
2answers
45 views

How to pin certain files when using sort?

Normally I am more creative with Unix commands and pipes, but not today. So what I have is this: collage.jpg DCIM001.jpg DCIM002.jpg or this: 001.jpg 002.jpg boston-collage.jpg or sometimes ...
-1
votes
4answers
226 views

Why does linux use file extension to decide the default program for opening a file though it's independent of file extensions

I have a text file as- abc.text and it has its contents as Hi I'm a text file. If I double click to open this file, then the files is opened in gedit editor. Whereas, if I rename the file to abc....
1
vote
2answers
67 views

How to extract a string from a file name?

I'm trying to read a part of a file name to make it in an if .. else statement for example : file name : foo_bar_test1_example.stat I want to do a test; if the word : example exists in the file ...
1
vote
0answers
114 views

How can I switch from one user to another user inside a script?

.The issue is my id 'aaa' can read only the file name and not the contents inside it when I log in with my id "aaa". So to read the contents I have to switch to another user "bbb" which is having ...
2
votes
3answers
217 views

Find and rename files (including directories) whose filenames contain space [duplicate]

I have quite a number of files and directories with spaces in their filenames in my ext4 filesystems. How should I safely find and rename them? I have bash and am running Ubuntu. Is it possible ...
0
votes
1answer
50 views

Unable to move files having spaces in their name [duplicate]

I want to move files from one folder to another folder, my code is working fine when file name doesn't contain spaces but if there is a space in a file name then I am getting an error My Code is as ...
3
votes
3answers
45 views

Ignore spaces in for Loop while printing file name?

I am trying to get files having size greater than 1k and with an txt extension my code is as follows : files=$(find foldername -size +1k -name \*.txt -exec {} \;) for item in $files do echo $item ...
0
votes
0answers
23 views

Forced search on specific folders in file manager

I am running Arch using XFCE as a DE. I currently have Thunar as my file manager but I have installed Gentoo and Xfe remotely so I am waiting to have a look at them. My question is: in some file ...
0
votes
2answers
33 views

Bulk rename, change suffix? [duplicate]

How can I bulk replace the suffix for many files? I have a lot of files like NameSomthing-min.png NameSomthing1-min.png NameSomthing2-min.png I would like to change all them to NameSomthing.png ...
5
votes
1answer
115 views

How to fix file name encoding

I scrapped a site with wget. That site is in German and some of that pages had Ü,ü,Ö,ö,Ä,ä,ß in the URL. Now some files have a very weird name. For example one file is called mirror.de/�%...
1
vote
1answer
45 views

Remove a part of a path from a variable content

In a Bash I have a variable: LOCAL_PATH="/this/is/a/path/" Then I have another variable, which content starts with LOCAL_PATH and it should be removed: LINE="/this/is/a/path/which/is/longer" The ...
1
vote
2answers
63 views

How to remove prefixes and suffixes from filenames in a given directory?

I have many files with the same prefix and the same suffix. I want to remove both from filenames. Both contain spaces. So foo bar XXX doo par.jpg, foo bar YY YY doo par.jpg would become XXX.jpg and ...
5
votes
1answer
153 views

How to decompress files from an archive ignoring the file names?

I have several ZIP and RAR archives where the filenames inside the archive are scrambled and they contain invalid filesystem characters like ?-s *-s or !-s or very long file and directory names that ...
0
votes
0answers
24 views

how to find (,put in folder) and relink to post: pictures moved to other directories

I have some 24000 pictures that have been mistakenly scattered into different directories under one top directory (upload). Now I have broken links in (wordpress) posts that were linking to these ...