Questions tagged [filenames]
File name is a name used to identify a file uniquely on given file system.
1,133
questions
16
votes
4
answers
2k
views
Delete a file called '.env'$'\r'
I have no idea what created this file - I guess a terrible shell script.
It is called '.env'$'\r'
I have tried various versions of rm, and the technique of opening the direcory with vim ./, selecting ...
0
votes
2
answers
14
views
What is the colon in postgres' process command-lines?
For example Postgres process command-lines are like
postgres 794 1 0 Nov06 ? 00:00:03 /usr/pgsql-9.3/bin/postgres -D /var/lib/pgsql/9.3/data -p 5432
postgres 857 794 0 Nov06 ? ...
2
votes
0
answers
43
views
How to find (and move) all duplicate file names
Due to moving files back and forth from my Linux PC to a Mac, I now have a few documents that duplicate. Their names seem identical, but apparently they are codified slightly differently, like in this ...
0
votes
1
answer
41
views
awk how to set the format output filename for multiple output
I have a file (file.csv) which looks like this:
abc 123
abc 001
abc 014
bos 011
bos 034
bos 079
bos 004
...
PS: column 1 of file.csv has 27297 unique words in total, and file.csv has 789234 rows in ...
3
votes
1
answer
148
views
Handle names with spaces when iterating recursively over files [duplicate]
I am trying to recursively convert all .mkv files in a folder structure with subfolders to .mp4.
I got a standard line that works in just the present folder
for video in *.mkv; do ffmpeg -i "$...
0
votes
1
answer
37
views
looping through filename [closed]
I need to use a function that has as input multiple files. These files are related by the filename (e.g. dog1_animal.txt, dog2_animal.txt, dog3_animal.txt, cat1_animal.txt, cat2_animal.txt, ...
-2
votes
1
answer
62
views
What are the implications of adding "./" to relative symbolic links?
I noticed that when I create relative symbolic links, starting the source path with ./ keeps it that way and starting with an alphanumeric character keeps it that way, despite them both meaning the ...
-1
votes
2
answers
54
views
How rename files in two subdirectories which have the same name?
I have two subdirectories, s1 and s2, and each has files named file_1 and file_2 in them. How do I change the names of these files into, let's say, s1_file1, s1_file2, and s2_file1, s2_file2, such ...
0
votes
2
answers
42
views
Remove particular words from filenames
I have a file named
[ NarutoG] Naruto - 084 Roar, Chidori! Brother vs. Brother! [720p] [x265] [pseudo].mkv
I want to change it to
Naruto - 084 Roar, Chidori! Brother vs. Brother!.mkv
I have ...
0
votes
2
answers
19
views
How to zip specific individual files in a directory
for example, this folder ~/folder1/folder2 contains a lot of files like:
abc_0101.txt abc_0102.txt ...
abc_0201.txt abc_0202.txt ...
abc_0301.txt abc_0302.txt ...
abc_0401.txt abc_0402.txt ...
how to ...
0
votes
1
answer
60
views
Ubuntu and Debian have different character encoding for filenames
I am mounting a NFS filesystem to a Debian, an Amazon Linux and an Ubuntu file system and they are showing different character encoding for file name.
An example file is displayed as follows in the ...
0
votes
1
answer
23
views
Convenient way to have selected files shown in the beginning of file lists in file managers?
In Windows if one wishes certain file (or directory) to be shown in the beginning of file lists in a file manager (no matter which one, really), one may choose to put the underscore character in the ...
0
votes
5
answers
74
views
print part of file name in the middle
I have several files with names as:
ID_Italy.txt
ID2_USA.txt
ID3_Germany.txt
.....
if I want to print before the _ I can do:
for file in *.txt; do print "${file%_*}";done
Output:
ID
ID2
...
4
votes
2
answers
205
views
loop through current directory store directory and subdirectory name in a array without duplicates
I have a scenario where I am looping through all directories and subdirectories in a given path; if a file with specific extension (.txt) is found, store the name of the directories and subdirectories ...
2
votes
2
answers
52
views
Maintenance script location
I have a bunch of maintenance scripts that are typically only run by cron or root. I had been putting them in /usr/local/sbin but honestly, I don't want them in the path. Normal users can't (and don'...
-1
votes
2
answers
68
views
How to find a file without showing "/"
im a beginner and I have no idea about the syntaxe of script shell Linux.
I have to show only files ending with (.sh) which is already done.
but these file ending with (.sh) their names has to be ...
1
vote
1
answer
107
views
Append (rename) and move files based on the directory name in their path
Goal: Append (rename) and move only those files whose path contains a specific directory name, at any level.
Extracting files from trees based on directory names. From years of periodic mobile backup, ...
1
vote
1
answer
179
views
Bash script to read all files in a directory, adding their filenames into a string for use in a command line argument
I have a bash script that does something like this:
java -jar executablefile.jar --width 100 --speed 50 --ouput outfile.mp4 --input file1.dat file2.dat file3.dat (etc)
I am able to read all the files ...
5
votes
3
answers
178
views
Multiple column alphabetical and numerical sort
I want to sort
based on the file name.
For the case where the file name prefix matches and the file ends in a number, I would like to have those numerically sorted based on the number at the end of ...
0
votes
0
answers
26
views
Equal sign as file name separator: are there any caveats? [duplicate]
Currently I have a recursive directory of files that looks like the following
foo_1/bar_1.txt
foo_1/foo_2/bar_2.txt
foo_1/foo_2/bar_2a.txt
foo_1/foo_2/foo_3/bar_3.txt
...
I need to use a bash script ...
0
votes
0
answers
15
views
General purpose file filtering tool
Lots of different applications have standards for generating sets of files, with files to be included or excluded specified in a separate text file. Git has .gitignore, Rsync has .rsync-filter, Plex ...
5
votes
1
answer
313
views
View file names in hex?
I have some files with special characters like accented letters.
They are valid names, but for some reason when they are copied across the network to a drive, maybe in another format, the name still ...
0
votes
0
answers
24
views
UTF file names listing in xterm
I noticed that file names containing UTF characters have different listing results in my xterm & UXTerm.
The first and the worst of all is they are listed/output as 8-bit enabled ASCII characters ...
0
votes
3
answers
70
views
Change number written in scientific notation in filenames
I'm going to make a video of image files, but the filenames contain numbers in scientific notation, so the ordering of the name will not be correct.
The filenames are in this format:
ABC_1.000000E-01....
0
votes
1
answer
14
views
Bind mounts for renaming
Can I do a bind mount on file "b" from file "a" such that file b also adapts the name of file "a"?
Ex:
ls / a foo/b
mount --bind a foo/b
ls / a foo/a
0
votes
1
answer
75
views
Changing part of the name of many files to unique names, using a spreadsheet of names
I need some help. I want to rename very many files with unique filenames using bash. I want to keep part of the original filename.
For example:
current file name
new file name
F1.R23.fastq.gz
10_1....
2
votes
2
answers
177
views
What is an effective way to automatically append file extensions to extensionless files?
I wrote a bash script today during my lunch break that finds extensionless files in a directory and appends a file extension to those files.
The script is relatively long because I added a bunch of ...
3
votes
1
answer
245
views
How to remove underscore between two numbers in all files in a directory
So I have a directory with nested folders, and at some point there are .png images.
The naming of these images is like this "letters_numbers_numbers_letters.png", and I want to delete the ...
0
votes
1
answer
107
views
Bash filename expansion: Avoiding certain character
In Bash, I can specify filenames Foo1.png through Foo9.png using Foo[0-9].png. I can avoid Foo5.png using Foo[1-46-9].png. Is there any way to specify a series of exclusions for the decimal digit?
...
-2
votes
1
answer
31
views
Search for file existence
I have a .txt file with a set of file names and I wanted to check the existence of those files in a directory.
cat file list.txt
File1
File2
File3
My script should check if these files exists in the ...
0
votes
1
answer
24
views
I have file containing relative paths to many files, how to print only names of PDF files from this into another file?
So I used the find command to write relative paths to files that meet certain criteria into a text file. Now, I want to process this file so only the file names are printed without the path. Thus, ...
-1
votes
1
answer
35
views
What's the difference between the pile paths '/' and '//'? [duplicate]
I noticed in Ubuntu that the following commands go to seemingly different locations in the file system, but the locations have the same files:
cd /
cd //
ls-ing from both locations produces the same ...
0
votes
2
answers
75
views
Does ext4 have any issues when I have curly braces in folder names? [duplicate]
I decided to rip some of my Audio CDs to FLAC and although I try to avoid special characters in the name of the folders I named some of my folders with curly braces:
1973 - Aerosmith {1993 Remaster}
...
2
votes
6
answers
862
views
Group and count file names following a pattern
I have a large number of files in a folder with a specific naming system. It looks somewhat like this:
my_file_A_a.txt
my_file_A_d.txt
my_file_A_f.txt
my_file_A_t.txt
my_file_B_r.txt
my_file_B_x.txt
...
0
votes
1
answer
45
views
How to open the n most recently modified files in less/vim?
How can I open all and only the n (e.g. 5) most recently modified files in a directory in less or vim?
I know I can use ls -t to sort the output from most recent to oldest. So my intuition would be to ...
0
votes
1
answer
273
views
Git clone; how to deal with directory clashes?
I have noticed that Git clone can easily download all files of a GitHub repository to to a directory named exactly as the GitHub repository (without having to deal with archives).
If a directory with ...
0
votes
1
answer
27
views
Rename odbc.ini file
Can you please let me know how can I replace the name from odbc.ini (old name) to .odbc.ini (new name) in putty using Linux commands?
0
votes
2
answers
103
views
Can a file path be invalid UTF-8?
Title says it all: if I have the bytes of a file path and I try to decode them as UTF-8 is it possible that the operation will fail (i.e. the bytes of a valid unix file path can be invalid UTF-8)?
10
votes
1
answer
2k
views
Why can't I copy all files in a directory to a USB storage device?
The sdc1 was mounted on /media/debian/Ventoy.
debian@debian:~$ sudo blkid | grep Ventoy
/dev/sdc1: LABEL="Ventoy" UUID="F82D-76BE" BLOCK_SIZE="512" TYPE="exfat" ...
0
votes
3
answers
110
views
Linux rename single unknown file to new_file.txt
I have found many examples of batch renaming of multiple files to a new file with the same pattern. However I want to just rename one file to a fixed file name. I am frequently receiving a new file ...
-1
votes
1
answer
40
views
How to: Copy Images from Gnome to public_html on same server
Hi there I am using CentOS7 as server + GUI. I want to move pictures from Gnome to a public_html directory. What is wrong with my command?
cp -R ~orca/Documents/Tree\ of\ Knowledge/oceanahomes.com/...
0
votes
2
answers
153
views
Loop over file names in a subdirectory that have periods, but exclude the path and file extension
I have a bash script in directory ./. This directory contains the directory output. Within output are files such as...
Alabama.txt
U.S. Virgin Islands.txt
How do I loop thru the files in output and ...
6
votes
4
answers
1k
views
How to pipe filenames with spaces from a list file into "grep"?
First, I think the fact that I'm using cygwin is highly relevant here.
In theory, I already know how to do this:
cat file | xargs grep pattern
The problem is, some of the file paths in file have ...
0
votes
1
answer
50
views
How to change two alternative file extension with a specific extension?
I have two different file extensions abc.fq.gz and abc.fastq.gz and I need to change these to abc.sam.
I tried this:
#!/bin/bash
refdir="Homo_sapiens.GRCh38.dna_sm.primary_assembly"
forward=(...
0
votes
3
answers
412
views
Can't move/copy/download files with ?, !, :, or | to exFAT flash drive
I've got a bunch of video files on my laptop's internal ext4 SSD (running Ubuntu 20.04, but this same error would presumably occur on any Linux install running kernel version 5.4 or newer, as exFAT ...
0
votes
2
answers
83
views
How to sort filename list (txt-file) by sub-strings of the filename/path with multiple levels. Special challenge: Two types of filename conventions
I'd like to sort the following list of filenames / pathes.
L1_Data/level1/192027/LC08_L1TP_192027_20201126_20210316_01_T1 DONE
L1_Data/level1/192028/LC08_L1TP_192028_20201126_20210316_01_T1 DONE
...
0
votes
1
answer
123
views
kde dolphin customs menu how to run a python script and pass the dire and file as?
In running XFCE
In Dolphin I wish to have a right click context menu,
says myPythonScript,
that will run the python script with directory and path as python sys.argv[1], sys.argv[2]
In Thunar to run ...
13
votes
3
answers
2k
views
List all files with extensions .tif, .tiff, .TIF, .TIFF
Given a nested directory, I would like to list all tif files with extension .tif, .TIF, .tiff, .TIFF.
Currently I'm using
find . -type f -iname *.TIF -print ; find . -type f -iname *.TIFF -print;
...
0
votes
0
answers
180
views
Using EXT4 partitions with WSL2
If I use WSL2 to mount an ext4 file partition, how will Windows treat the characters that Windows traditionally disallows but Linux is fine with using?
2
votes
2
answers
300
views
Unzip a .zip which includes directories with spaces in Name
I have a problem with unzipping my transfered .zip file.
Firstly, I zipped a owncloud data directory with the encryption parameter. Then I transfered it to my new Server und would like to unzip it ...