Questions tagged [filenames]

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

Filter by
Sorted by
Tagged with
0
votes
2answers
25 views

How do you sort a list of filepaths by the filename?

I have the following list of files in a textfile named files.txt: ./themes/seven/images/list-item-rtl.png ./themes/seven/images/arrow-desc.png ./themes/seven/images/arrow-prev.png ./themes/seven/...
1
vote
1answer
40 views

Directory traversal to root or home from any location

Param is my input, which is added to the cat command so basically eval "cat /a/really/long/path/idk/how/long/$param1" on changing the param1 to something to something else can I access the ...
0
votes
1answer
19 views

Ranger: custom file sorting (dotfiles at the end of listing)

I am using ranger as cli file manager. I would love to order files in this way: Folders alphabetically Files alphabetically Folders starting with . alphabetically Files starting with . alphabetically ...
0
votes
1answer
31 views

Using mmv, how do you replace every x with y?

So my filename looks like this : Building+a+Container+for+Robust+Conversations.pdf I would like to use mmv to rename it like this : Building_a_Container_for_Robust_Conversations.pdf Or like this : ...
0
votes
1answer
26 views

How to remove files having the same name of subfolders in a different folder?

I have 10k files into a folder (folder_A). A second folder (folder_B) contains 100k subfolders. Some of the subfolders have the same name of files into folder A. Here is an example: ls ./folder_A aaa....
1
vote
4answers
45 views

How to rename dates in multiple file names

I have files that look like this: ABC_20210101.csv ABC_20210101_imp.csv I would like to update the dates in the file name to a specific date: ABC_20201231.csv ABC_20201231_imp.csv How can I go about ...
0
votes
1answer
17 views

extract fasta files starting with same name in each of the directory into a single output file

I have multiple directories with multiple fasta files in those directories. I am trying to concatenate all files starting with a specific name in each of the directory into a single file. hpa_C.seq ...
0
votes
1answer
33 views

Synchronizing with rsync outputs error “Invalid argument (22)” for directories with dots and other symbols in their name

I tried to synchronize /dir1 (ext4) and /dir2 (ntfs) using rsync -azP, but got these errors: rsync: recv_generator: mkdir "dir2/X.Y." failed: Invalid argument (22) rsync: recv_generator: ...
1
vote
2answers
31 views

How can I identify file names and directories from logs of Unix commands?

I have a data-set of Unix commands as input into terminal and I want to use them to compare user behaviours. Different users interact with different directories and files (they are all on separate ...
0
votes
1answer
25 views

List only files and not directories in archive

I have a zip achieve like below $ unzip -l 5124.zip Archive: 5124.zip Length Date Time Name --------- ---------- ----- ---- 0 01-13-2021 09:22 u/ 0 01-13-2021 09:...
1
vote
2answers
36 views

How to rename a file to its creation date and hash value combined in order to achieve unique filename?

I have bunch of .JPG, .NEF and .MOV files made with my Nikon DSLR, named as DSC_0001.JPG, DSC_0002.JPG and so on. After certain number is reached, new directory is made and number count restarted, ...
2
votes
2answers
40 views

Delete duplicates from another directory recursively

(N.B. There are many similar questions (e.g. here, here, here, and here) but they either assume that the directory structure is one-deep, or the answers are more complex multi-line scripts.) This is ...
1
vote
3answers
38 views

avoid spaces and apostrophes problems with ls in a awk script [duplicate]

I have many identical files in two (local) devices, and it happens that I have renamed some, only in one device (A). I found the following way to rename the identical files in the other device (B), ...
0
votes
1answer
54 views

How to rename a batch file

I want to rename a file from Chat WhatsApp dengan A3 - 21.mp4 Mine.mp4 MoviMax_MV1_V016_2.106.001_20150227_2030_fbf.mp4 bedrock_server.mp4 to test1.mp4 test2.mp4 test3.mp4 test4.mp4 How can I do it?
0
votes
1answer
29 views

mutt attachment with long non-ASCII file name is set to “noname”

When I'm attaching a file with Russian name, the recipient received the attachment with name noname. I added set rfc2047_parameters = yes to .muttrc, and it started to work for simple filenames like ...
1
vote
0answers
43 views

Bash: Mask a filename with another name, inline?

The problem here is as follows: I have a python project with python and bash cli tools. I have structured the executables' CLI interfaces in compliance, more or less, with POSIX interface standards. ...
0
votes
3answers
64 views

AWK command cut the file name

fileName=20201211-v1-ABC144_newrecords_2020-12-10_12-51-32-000_2444_511 fName1=$(echo $fileName | awk -F"-" '{ print $3 }') CUT the file name from $3 to until date value I need file name to ...
0
votes
1answer
35 views

Rename Files in Directory Appending Three Digit Numbers and Spaces and Varying Extensions via Terminal

I have a list of files in a directory that display like this via an ls command: 01-Campout 2001.jpg 2-Campout 2001.png Campout 2001 - 3 of 21.tiff Campout 2001 - 4.pdf I would like to know what bash ...
1
vote
3answers
62 views

Combining Unique Pairs of Files with find

I have a series of actions I need to preform on pairs of files, on a fair number of files. For simplicity, I'll focus this down on just doing a simple cat on a pair, to discuss the pairing and how to ...
0
votes
1answer
34 views

Line editor ed saves some filenames in single quotes followed by one space

I'm following The Unix Programming Environment exercises and have encountered some weird issues, while going through the ed exercise, when you just start ed, type in the exercise then do w poem It ...
0
votes
0answers
21 views

Short form file names when viewed in Windows

I realise that this is possibly more of a Windows question than a Linux one, but maybe someone knows the answer or can point me to a suitable better forum (I shall post the same on Stack Overflow), ...
0
votes
1answer
69 views

Matching a string that contains regex tags

I have a bunch of video files with associated subtitles. I am trying to program a bash script that merges the subtitles and videos into matroshka containers. The input video files are named "...
1
vote
1answer
27 views

How to properly use mmv and avoid “no match”

My folders look like this: $ ls total 20K drwxr-xr-x 2 ychaouche ychaouche 4.0K Mar 4 2020 cdc-firewall-v1 drwxr-xr-x 2 ychaouche ychaouche 4.0K Mar 4 2020 cdc-firewall-v2 drwxr-xr-x 2 ychaouche ...
1
vote
1answer
33 views

Mounting ISO with`fuseiso` produces different filenames than `mount`. How to change this behavior?

I need to mount an ISO as non-root. File names inside the mounted ISO matter. Since I'm "non-root", fuseiso is the most logical choice, but it doesn't produce "correct filenames", ...
6
votes
2answers
241 views

Is there a reasonble way to increase the file name limitation of 255 bytes?

It seems that the file name length limitation is 255 "characters" on Windows (NTFS), but 255 "bytes" on Linux (ext4, BTRFS). I am not sure what text encoding those file systems use ...
-2
votes
2answers
53 views

Append suffix to all files with a certain extension

Write the command that will locate all files that have the suffix/extension of .py. For each file that is located, the command should append the suffix/extension of .backup to the file. So, if a file ...
0
votes
3answers
71 views

find results containing space to be printed with enclosing quotes

How can find search results containing spaces to be printed with enclosing '' (a quote pair). Only if this result contains spaces, if there are not spaces in the path string, to remain as is.
0
votes
3answers
111 views

How to extract the numbers from a filename

How do I get only the numbers from a filename in another directory? Using ONLY sed awk or bash? Assume it can be any arbitrary length but the format will always be ABC1234. If I have a file name ...
0
votes
1answer
57 views

How to retrieve folders name in a directory with bash

I'm trying to get the names of the folders inside another folder. I was trying to use the bellow code but the problem is that it return the full address of the folder instead of just the folder name ...
0
votes
1answer
53 views

How is * interpreted on bash command lines? [duplicate]

What would be output if we type something like this in our terminal /home/user/some character with * e.g. /home/renga/i* I pass a variable (home/renga/i*) like this in my script, in run time the ...
0
votes
1answer
63 views

Rename files from .txt list

I've got .txt list with files and corresponding MD5 hash: ab16d9ab5682bb0038c901ad8fc424c0 *file1.doc 28bb8e092301340f19585201166e5b86 *file2.doc 5f53d5e9512a717049185fcf617b8a37 *file3.doc ...
2
votes
1answer
33 views

Trying to append a group of files with date; my script amends the file type instead!

find . -maxdepth 1 -type f -exec sh -c 'mv -- "$0" "$0"-$(date +%Y%m%d)' {} \; I'm so close to getting this script to work for a daily group of csv files. Instead of adding the ...
1
vote
1answer
25 views

How can I find and remove files with a carriage return (\r) in the filename?

Somehow, I seem to have generated files with a carriage return (\r) in the filename: $ ls -1 tri-rods.tm.dat* tri-rods.tm.dat 'tri-rods.tm.dat'$'\r' $ ls tri-rods.tm.dat? 'tri-rods.tm.dat'$'\r' I ...
1
vote
1answer
34 views

zgrep a column and print the matching filename

I am trying to match pattern for a particular column in the thousands of gzipped files on a Linux machine, and based on the match I want to print the file name how to do that. Below options are not ...
1
vote
1answer
61 views

filenames with ' in, (we're) is messing with my script

I have a script that first move the selected files into a temp directory,scans the directory, takes the largest file and create a new directory with that name, and moving all files to the newly ...
1
vote
1answer
72 views

Sort files in directories based on filename

I have > 35,000 scanned diapositives from a scientific archive in one directory. (Fortunately, the filenames are rather uniformly formatted: {year}-{place}-{film-#}-{photo-#} OR {year}-{year}-{...
0
votes
3answers
98 views

How to test if one or more files with a prefix exists in bash? e.g. [[-f foo*]]

Is there a way to use a Filename Expansion within a test expression, more specifically, a bash conditional expression? For example: [[ -f foo* ]] && echo 'found it!' || echo 'nope!'; ... will ...
0
votes
1answer
64 views

How to change end of filename

I am using Mac Terminal and I need to delete end of filename. Example of filename : 1516092009.M432844P7000.camel5,S=14022,W=14295/2, I need to delete the end /2, and I tried command: rename 's/\/2,//...
0
votes
1answer
20 views

swap fields in file names

How can I do the following change in file names. I suppose this is possible with rename, but I do not know how. A_B_C.pdf to C_A_B.pdf A, B and C are different words in my file names, like ...
1
vote
1answer
44 views

How to replace part of a filename with input from stdin?

Let's say I've got a file ids.txt with several entries like foo bar bam ... for example. I'd like to use this as input to run a command on some files containing the ids in the filename like foo_1.gz, ...
1
vote
4answers
62 views

String substitution to detect empty variables?

I have a script that iterates through files and does some string substitution to insert the date. #!/bin/bash f="/tmp/file.txt" # with .txt extension timestamp="$(date +%H%M%S)" ...
2
votes
2answers
71 views

Why tar uses absolute path even though I have changed to dir via -C?

Having this: $ls $des/bin a.c analysis.hpp classify.hpp main.cpp split.hpp a.cpp a.out grade.cpp main.out student.cpp analysis.cpp classify.cpp grade.hpp ...
4
votes
3answers
2k views

Files names with an ' (apostrophe) inside of them

When I list files that have spaces in their names, most of the time I see them surrounded by apostrophes : 'famille, vacances, loisirs' I had to edit a file whose name had to be : Chapitre 2 : L'accès ...
0
votes
2answers
38 views

Compare multiple file suffixes containing date & time and do action on most recent

I have multiple files in a directory that follow the below pattern. logA.log.$todayDate.$timeCreatedlogA.log.07222020.084355 I want to compare the $timeCreated part of all the files in the directory ...
1
vote
1answer
160 views

Find filenames that contain number

I would like to find file names which contain a number and list them in a range of numbers. For example, in my directory I have: ** Ion_001_rawlib.bam Ion_002_rawlib.bam Ion_003_rawlib.bam ...
1
vote
2answers
58 views

How to find directories (or files, etc.) based on an expression that applies to the file pathname [duplicate]

I'm trying to find/extract directories based on an expression that applies to the file path. For example, I used the command: find . -type d -links 2 To get a list of directories that looks something ...
0
votes
1answer
24 views

Disable bash autocompletion for combinations of specific commands and specific filetypes

In the current directory, if we have a C++ source file, hello_world.cpp and the corresponding compiled executable binary hello_world, I'd like to have the autocomplete feature of bash to completely ...
0
votes
1answer
19 views

rsync cannot exclude relative files?

I know the exclude option in rsync can only accept relative paths, so I though I can make workaround with realpath --relative. $ls /usr/local/bin cppman demangle e fusuma rem triangle $realpath --...
3
votes
3answers
453 views

How do I rename multiple files by removing everything but numbers?

I want to rename files like: SL Benfica vs. SC Beira-Mar 136.mp4 SL Benfica vs. SC Beira-Mar 137.mp4 SL Benfica vs. SC Beira-Mar 138.mp4 SL Benfica vs. SC Beira-Mar Jogo 074.mp4 SL Benfica vs. SC ...
-4
votes
2answers
53 views

Taking a specific part of the file name with shell script and put into loop

Let me explain, .SAC files are type of seismograms which SAC ( Seismic Analysis Code ) program use and the other files which contains *HH are response files. I want to remove insturment response which ...

1
2 3 4 5
22