Questions tagged [filenames]
File name is a name used to identify a file uniquely on given file system.
1,229 questions
0 votes
2 answers
59 views
Is make's $(<D) affected by nearby spaces?
Is there any hope of using $(<D) here? Any hope of avoiding the mystery dots? $ cat Makefile D=$(HOME)/Downloads test: $D/DreamHost\ Web\ Panel\ _\ Mail\ _\ Message\ Filters.html : mv "$&...
4 votes
3 answers
257 views
Get Character Code for Character in File Name
Short version: I am at a bash command line. In some directory, I can ls various files and see their names. I would like to get something like the ASCII character code for each character in a file's ...
4 votes
4 answers
496 views
How can I find common prefixes in file names to group them?
I would like to be able to find all files in multiple directories whose file names start with the same string, but preferably not if that string is only one word or contains fewer than perhaps 5 ...
3 votes
7 answers
1k views
How to list only the last name.partXXX.rar file?
In Linux in a folder, without subfolders, there are many files like this scheme. I list them with ls -1. 1yBWVnZCx8CoPrGIG.part01.rar 1yBWVnZCx8CoPrGIG.part02.rar 1yBWVnZCx8CoPrGIG.part03.rar ...
1 vote
2 answers
91 views
Ffmpeg generate fixed binary digit filename pattern
Suppose I have filenames like these 4-bit patterns: 0000.ts 0001.ts ... 1111.ts Basically, that file was generated from an RTSP stream that chunks every second. So, for each binary number ...
0 votes
1 answer
79 views
Alias for rm does not include file name with @$ [duplicate]
I am trying to create an alias for the rm command in the /root/.bashrc file on a VirtualBox Redhat VM (running RHEL 9). I cannot get it to work properly. This is an excerpt of my .bashrc file: alias ...
-4 votes
1 answer
142 views
How combination of find with sh solves problem with filenames
I was directed to this StackExchange post: Why is looping over find's output bad practice? The core issue is that Unix filenames can contain any character except the null byte (\0). This means there ...
0 votes
2 answers
156 views
Safely Handling Filenames with Newlines Using find and while read
I want to handle filenames with newlines in a bash script rather than having find "$search_dir" -type f | while IFS= read -r file; do Perhaps something like the following would do it find &...
4 votes
1 answer
775 views
How can I remove special non-characters that are not part of national alphabets like faces from filenames, keeping any national alphabets intact?
How can I remove special non-characters e.g. faces, avatars, emojis, symbols that are not part of national alphabets from filenames while keeping any national alphabets intact? e.g. ...
13 votes
7 answers
4k views
Idiomatic way of generating a unique filename?
In a script I'm writing, I want to create something temporary on my filesystem, but - it's not in /tmp but elsewhere, and may not be a file nor a directory (e.g. maybe it's a named pipe or a symbolic ...
6 votes
1 answer
418 views
Revert filenames after they were garbled by using different encoding
I have a file СМП бваг™вга† The first three letters are proper Cyrllic and the remaining part is mojibake. "Mojibake is the garbled or gibberish text that is the result of text being decoded ...
1 vote
3 answers
116 views
Duplicate and rename files with matching names but different extensions in bash?
Is there some simple way to duplicate both .cpp and .h files (or any multitude of extensions) simultaneously in bash, instead of: cp foo.cpp bar.cpp cp foo.h bar.h I'm not looking for shell script ...
1 vote
4 answers
2k views
How can I get the absolute path of a file deep within a directory?
Here's an example of directory level0 contents in a tree-like format. However, suppose it is huge and contains many files as I am omitting many of them here: $ tree level0 level0 └── level1 └── ...
0 votes
1 answer
169 views
unison start the sync from zero when I change the parent folder
I use unison to sync two folders that are in separate computers (via unison command with ssh). If for convenience I happen to change the name of the parent folder, unison start to sync the folders as ...
3 votes
1 answer
500 views
Extract a RAR file while automatically truncating long filenames
I have a lot of rar archives, and some of them contain files whose names are too long for the filesystem. When attempting to extract them using unrar x, I will get the error: Cannot create [extremely ...