Skip to main content

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
2 answers
50 views

How to loop through multiple subdirectories and change file extension

I was assigned to manage a legacy codeIgniter 3 code base. There is this error that the website doesn't load images that are .JPG. Rather than making it not case-sensitive we want to change every .JPG ...
Džiugas Balčiūnas's user avatar
0 votes
3 answers
81 views

Extract YouTube video IDs from the end of filenames

I downloaded some files from YouTube a while back with the YouTube IDs in their names. My problem is that some IDs contain a character that also marks the beginning of the ID itself. $ ls *.mp4 | head ...
Joshua Briefman's user avatar
0 votes
1 answer
82 views

Where is file path information stored?

Where is the file path infromation stored on ext4 file systems, within partitions? Obviously, it's stored on the drive itself because the structure is on the device itself (i.e. folders stay folders ...
FourierFlux's user avatar
0 votes
1 answer
40 views

How to delete file and folder with irregular names

the content of some folder is like that: Folder name is empty File name is asterisk I can find inode of these file and folder OS - z/OS OMVS, so, there is no option -delete on find command How can I ...
Barat Sahdzijeu's user avatar
3 votes
6 answers
206 views

Find files that are sorted before a given file

I have a directory with a number of files. Example: aaa.txt bbb.txt ccc.txt ddd.txt Given an arbitrary string (not necessarily the name of one of the files), I want to find all the files that are ...
Lii's user avatar
  • 175
2 votes
1 answer
55 views

Why leading zeros do not alter order of files?

In all three cases below (folder, files with zeros only and files with 1), I expect the order to be C-A-B and not A-B-C. Why are leading zeros not considered? It seems to be taking contiguous numbers ...
luchonacho's user avatar
0 votes
2 answers
47 views

Command to move directories not starting with a `.`

I would like to move all subdirectories in a directory not starting with . in bash. For example, given this directory structure: subdir1/ subdir2/ .idea/ .venv/ The command should only move subdir1/ ...
melvio's user avatar
  • 121
2 votes
2 answers
63 views

Listing a certain part of filenames and their contents

I have a Linux machine with BusyBox, which has a directory called /data/var/lib/connman.  That directory holds some directories that I'm not interested in.  But it contains many .config files that ...
Norbert's user avatar
  • 121
-3 votes
1 answer
90 views

What is the value, proper use, and behavior of a command's "absolute path"? [closed]

We have many questions that address an absolute path, sometimes for files, sometimes for commands. I want a central knowledge base question about what exactly an absolute path does as it relates to ...
Jesse's user avatar
  • 351
1 vote
2 answers
110 views

Use shell script to select a specific pdf with unique filename format and recent creation-date?

I am needing some help with a script. I'm currently trying to select PDF file that meets a specific requirement in the file name in order to move it to a different location. The filename format I'm ...
Brad Barnes's user avatar
2 votes
3 answers
625 views

Use of special characters in filename

I need to create a file named *'test'* If I write touch \'test\' ls shows 'test' But if I write touch \*\'test\'\* ls now shows *'\''test'\''* What's the trick ? Can someone explain me what I did ...
Shoopi's user avatar
  • 31
2 votes
1 answer
361 views

Dot file and an adjacent identically named file without dot?

Is it bad practice to have a dot file and an adjacent identically named file without dot? Background: We already create a $HOME/.ourapp directory where we store various configuration files, log files,...
Adám's user avatar
  • 191
4 votes
2 answers
545 views

Is it possible to run find command from a bash script where the multiple name filters comes from a file?

I'm trying to have some tracking on a folder and wanted to use the find -name filters from a file. So I've prepared a file called filter_files that contains the filter, for example: cat filter_files: -...
avij's user avatar
  • 43
0 votes
1 answer
77 views

How can I create a file named "\?$*'ChouMi'*$?\"?

I need to create a file with this exact name "\?$*'ChouMi'*$?\" so that ls would show it as: $ ls | cat -e "\?$*'ChouMi'*$?\"$ $
prince royce's user avatar
0 votes
1 answer
83 views

Linux program to quote filename only when necessary?

Consider having these directories and files: $ tree /tmp/test /tmp/test ├── dir │   ├── file_normal │   ├── file with "double quote │   ├── file with 'single quote │   ├── file with space │   └── ...
midnite's user avatar
  • 443
0 votes
1 answer
75 views

Identifying specific set of characters in binary file name

I am trying to create a bash script which achieves the following tasks: Read a binary file name. Check if input binary file name contains A1 or B1 (case insensitive). Depending on the identified ...
hymcode's user avatar
  • 83
1 vote
1 answer
254 views

How exactly does Nautilus sort files by name?

I noticed that Nautilus(GNOME Files) does not fully sort alphabetically. $ touch 1 $ touch 2 $ touch 3 $ touch '!2' Then the files are displayed in the following order: !2 1 2 3. This is fully ...
lv04438's user avatar
  • 11
0 votes
0 answers
30 views

match files with regexp and move them

My problem is like this: The original folder "datasets to optimize" contains 1000s files whose names contain the following pattern: variable 2-3 dots or 1 dot with numbers, as in 1.87.184 ...
user1420275's user avatar
2 votes
1 answer
57 views

How to rename files to specific string in their filenames

I have large amount of .json files that need to be renamed to a specific string of numbers in each file's name. They follow the format: [Artist] Title (Date) [Language][Publisher][Website.####][Pages]....
fukaeri's user avatar
  • 23
0 votes
2 answers
181 views

Return all files of a specific extension with directory and subdirectories paths

using terminal on MAC OS I need to return path along with the file name in the a directory and all sub-directories, but only if a fie has a specific file extension (e.g. .txt). I tried this, but it ...
Data Engineer's user avatar
0 votes
1 answer
128 views

Need help with ls and escape characters [duplicate]

I'm trying to create a bash script to run the ffmpeg command on every file in a directory with filenames that contain spaces. This is the script that I started with to do an individual file which ...
Maxhawk's user avatar
0 votes
2 answers
53 views

How to open a file starting with dash via xdg-open

Usually, a double dash separates options from filenames, but xdg-open does not care: ❯ xdg-open -headlinesAfter.epub xdg-open: unexpected option '-headlinesAfter.epub' Try 'xdg-open --help' for more ...
xeruf's user avatar
  • 571
1 vote
1 answer
90 views

Convert directory with opus files to CSV or similar?

I have a folder with opus sound files. I would like to convert that folder listing to something I can use in a spreadsheet. I want the result to contain something like file name, length of the sound ...
d-b's user avatar
  • 1
25 votes
3 answers
5k views

Is it now safe to parse the output of GNU ls?

The accepted wisdom for the past few decades has been that it is never a good idea to parse the output of ls ([1],[2]). For example, if I want to save a file's modification date along with its name ...
terdon's user avatar
  • 244k
2 votes
1 answer
89 views

Change Filenames Based on List in .txt file in Terminal

I'm trying to rename a bunch of audio files. They are named "1 Audio Track.aiff" and so on. I have a .txt file with the old filenames and the new filenames separated by a tab. For example, ...
Paul Decorte's user avatar
1 vote
3 answers
70 views

ls starting at particular file

How do I ls files in a directory beginning with a particular filename? For example, if my CWD has these files: $ ls -1 alpha.mp3 bar.xls file1.txt file2.txt foo.odt testing3.txt How do I print out ...
Geremia's user avatar
  • 1,185
0 votes
1 answer
36 views

Copy multiple files by filenames in subdirectories in linux

I can do the following to copy a file from subdirectories. find . -name "file1.txt" -type f -exec cp {} ./distfolder \; How do I change this code to copy multiple files (file1.txt, file5.txt,...
Sher's user avatar
  • 113
2 votes
3 answers
126 views

Sort a list of filenames such that files in subdirectories are listed before files in the parent directory

I have a text file containing a list of files, such as: file A1/file A1/B1/file A2/file How can I sort it such that files in subdirectories are listed before other files in the parent directory? A1/...
Ken Taylor's user avatar
0 votes
1 answer
135 views

How to copy files from a list without extension to a different folder?

I have a text file that contains a list of ids of files without any extension now I need to copy those files mentioned in the list head 01cBC.txt EE87786 EE87787 EE87788 EE87789 EE87790 EE87791 Now, ...
Debajyoti Kabiraj's user avatar
0 votes
2 answers
65 views

How to add subfolders from one directory to another directory with the same files unorganized, and prepend folder name to files

I am an R user who is not yet familiar with unix or command line coding. I have a directory with subfolders containing files, and I have another directory with all the same filenames and no subfolders ...
slund's user avatar
  • 1
0 votes
2 answers
129 views

Dangers of executable file with '#' in name?

This might be a FAQ--happy to have the question closed if it's a dupe--but I'm not sure how to find it if so. I'd also be happy with an answer that simply told me how to find the relevant ...
Mars's user avatar
  • 103
1 vote
1 answer
163 views

How can I rename files recursively using a regular expression

I have hundreds of files on a hard drive with many directories and sub directories which start with: 1.1, 1.2, 1.3, 2.1, 3.1, 9.1, 10.1, 10.2, Etc Etc... The problem is that when I list them they ...
Chris Fox's user avatar
0 votes
1 answer
1k views

Write directories, subdirectories and file names to .txt file

I am looking for a command that will write the names of all directories, subdirectories and file names to a text file. Example format: directory1 |_subdirectory1 | |_filename1.mp4 |_subdirectory2 | |...
linuxuser24569's user avatar
0 votes
1 answer
347 views

Create file with pipe character ("|") in filename on Ubuntu/Windows11 dual-boot machine

I'm running Ubuntu 22.04 and would like to create a file having the pipe character ("|") in its filename. (Necessary to run some legacy code.) Specifically, how do I identify and correct ...
Iron Pillow's user avatar
0 votes
2 answers
95 views

Delete files with similar names

I have been away from scripting for years, so I was wondering if someone can help in the below. I am migrating from Google Photos to Amazon Photos (about 40k photos). Here is an example of what I ...
HimaTech's user avatar
0 votes
1 answer
243 views

Winrar error: Attempting to correct the invalid file or folder name

Posting this since I could not find it using Google and this took weeks. When extracting using Winrar, I am getting ! Attempting to correct the invalid file or folder name ! Renaming C:\Users\noam.s\...
Gulzar's user avatar
  • 135
0 votes
1 answer
300 views

Testing whether variable has valid video file extension

How can I test whether a variable has a valid video file extension (.mp4) ?
Vera's user avatar
  • 1
1 vote
3 answers
232 views

How do I find the directory with the longest path?

How can I find the directory with the longest path (contains the largest number of subdirectories) , in the current directory , using ls ~ -R commmand
bara's user avatar
  • 19
-2 votes
1 answer
628 views

how to create a directory that already exists with another name

i want to create directory called "A" inside my home directory but i don't know if such a directory already exists. i want to write a command that creates the directory if it does not exist. ...
bara's user avatar
  • 19
1 vote
0 answers
115 views

What does it mean when a file isn't detected with a wildcard search? [closed]

I have three files in a folder: trace-0.fits, trace-1.fits, trace-2.fits. When I run: ls trace-?.fits Only trace-0.fits and trace-2.fits are detected. But: ls trace-1.fits Detects trace-1.fits, as ...
jyoung's user avatar
  • 111
0 votes
1 answer
306 views

Remove all bracket types and any strings within them from all files in a directory

I have thousands of really old video files that have brackets of all types strewn in them in no particular order. I'm trying to "clean" them, that is, rename these files so that all the ...
liasbox's user avatar
0 votes
0 answers
29 views

Is there a useful utility for managing multiple "alternatives" of a given file?

The example I'm going to give here is a simple media file conundrum. In this example, say I have multiple versions of a given audio file: SomeSongLibrary/ awesome-song-compressed.mp3 awesome-...
TheYokai's user avatar
  • 139
11 votes
3 answers
1k views

What is the difference between locate txt vs locate *.txt?

Output of locate txt | head: /etc/brltty/brl-ba-all.txt /etc/brltty/brl-bd-all.txt /etc/brltty/brl-bl-18.txt /etc/brltty/brl-bl-40_m20_m40.txt /etc/brltty/brl-ec-all.txt /etc/brltty/brl-ec-spanish.txt ...
Random Person's user avatar
0 votes
2 answers
126 views

Need help with a command to find all filenames that are too long and delete from a directory

I have been using the following command: find . | awk 'function base(f){sub(".*/", "", f); return f;} \ {print length(base($0)), $0}'| sort -nr | head -2 It will find some files ...
linuxuser24569's user avatar
0 votes
3 answers
79 views

Is it wrong to do tar czf somename.tar some_*_files?

Is it wrong to do tar czf somname.tar some_*_files instead of tar czf somname.tar.gz some_*_files, then of course tar xf somename.tar? That is : without adding the .gz extension. This question is ...
Nikos Alexandris's user avatar
0 votes
1 answer
73 views

How to find and manipulate files that contain newline in filename?

follow up on How to find files that contain newline in filename? , I need to do some manipulation on the result, for simplicity lets suppose I need to chown them. Tried following, but does not work: # ...
Nick's user avatar
  • 125
1 vote
3 answers
385 views

Removing directories with spaces in their directory paths

I'm on macOS. I have many directories at paths that looks like this: ./FirstName SecondName/A Multi Word Title/Contents/Index/files I want to remove ALL the Index directories and their contents. I ...
rbpeirce's user avatar
3 votes
1 answer
478 views

How can I paste full path strings in the GNOME File Selection Dialog on RHEL?

I have a remote RHEL machine which I use via X11. On that machine when I open a new file in, say, VS Code or in the Firefox browser (both apps are on teh remote machine), then I get teh following File ...
halloleo's user avatar
  • 589
9 votes
1 answer
1k views

What is the meaning of `*(1)*` in a command?

Why use of *(1)* removes everything from a directory? Then how to select all files that has (1) in the middle of it's name? The command used is rm *(1)* or rm -rf *(1)* (don't remember exactly). It ...
Ya Y's user avatar
  • 93
0 votes
1 answer
145 views

Make (`ocrmypdf`) command run in terminal AND include input name in that of the output

I have this line inside a Dolphin service-menu file that contains many other commands for PDF processing: Exec=bash -c 'f="%u"; ocrmypdf "$f" "${f%.pdf}_ocr.pdf";' It ...
cipricus's user avatar
  • 1,629

1
2 3 4 5
25