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
1 answer
12 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 ...
  • 1,204
0 votes
1 answer
12 views

CUPS - Display filename in the Joblist

Is there an option to display the printed filename in the CUPS job list? From the job list, based on the filename user would select the files to be reprinted. Earlier we were able to achieve this when ...
  • 1
1 vote
4 answers
59 views

How can I remove files that have an unknown number in them?

I have some code that writes out files with names like this: body00123.txt body00124.txt body00125.txt body-1-2126.txt body-1-2127.txt body-1-2128.txt body-3-3129.txt body-3-3130.txt body-3-3131.txt ...
1 vote
1 answer
29 views

Split file with both post and prefix

How can I split file in Linux with number increment between post and prefix For example split -b 10M MyImages.tar.gz "MyImages*.tar.gz" Result MyImages01.tar.gz MyImages02.tar.gz ...
0 votes
2 answers
22 views

List and count subdirectories that have files with same name character on string

Picture this: |-Main_folder |- Folder1 |- E_1 |- E_1_A |- file_E_1_A_F_1 |- file2_E_1_A_F_2 |- file3_E_1_A_F_3 |- E_1_B |- file1_E_1_B_F_1 |- ...
0 votes
1 answer
48 views

Prevent process from overwriting files

The setting Let's say I have an executable file, let's call it program, whose source code is unavailable (maybe proprietary/legacy). Each time this program is executed, it generates a file, let's call ...
16 votes
2 answers
4k views

Can't create files or directories that starts from 'com1' to 'com9'

I can't create folders or files named 'com1', 'com2', ..., 'com9' in my extended hard drive. I'm trying to create a Wine prefix on my other drive where my games are stored, but I get some errors. ...
  • 171
0 votes
1 answer
24 views

Problem with sample names in the file created using awk

I have some data like below: dir1 |___dir2 |___dir3 |____files |____TGH4_1.tar.gz |____TGH4_2.tar.gz |...
3 votes
1 answer
37 views

How to find (and rename) files with invalid characters (Latin1) on UTF-8 system?

I've got some old files from a Latin1 based system with names that are invalid on my UTF-8 system. They show as various codes or question marks. For example: /tmp/test $ ls -1 'FRg_Pause lecture_'$'\...
  • 2,040
1 vote
2 answers
68 views

Moving files based on filename

I have folder with .tif files that I want to move based on their filename to a folder with same name. Example file 123456789_002.tif --> dir 113456789 . How do I get the first part of the file ...
1 vote
1 answer
35 views

TAB expanding filenames after make command in bash

I'm preparing a makefile for converting org files to markdown files with the use of pandoc. Its content looks like this (note that conversion rule is just for a reference): %.md: %.org pandoc -t ...
0 votes
0 answers
35 views

Shell scripting with brackets/parenthesis in folder names [duplicate]

I have a music library that I am trying to restore from backup. The original source library was on a QNAP NAS and I copied it over to a CentOS system without any problems. Now that I am trying to copy ...
0 votes
1 answer
67 views

How to remove the dash for multiple files in linux

I'm having files named like HCW-00109-01.sam I want to change the name of them into HCW0010901.sam Can someone help me with this?
0 votes
0 answers
13 views

find all files with naming pattern & create symlinks by trimming last part of extension

I have tree of directories with config files in each, like this |-- dir1 | |-- file1.config |-- dir2 | |-- file2.config I want to find all files with pattern "*.config" and create ...
  • 1,757
1 vote
1 answer
202 views

Systemd service prefix on ExecStart=@/path/to/executable doesn't change the `argv[0]`

According to the manual man systemd.service using the prefix @ says this: If the executable path is prefixed with "@", the second specified token will be passed as "argv[0]" to ...
0 votes
1 answer
88 views

output filename and 'found string' on same line in output file

Semi-newbie. Trying to automate something using an awk script. Should be simple - in theory. Set of files, all ending in .lst. In each file there is a single line (out of hundreds) with a particular ...
0 votes
1 answer
39 views

How to add incrementing numbers before file extension .mp3

Aloha from Hawaii, I hope all is well. In terminal, am trying to make all the filenames of the audio files extensions .mp3, .wav, .m4p, .aiff, .m4a to be unique. I have thousands of them so in order ...
3 votes
1 answer
818 views

How can I batch rename all files that match a pattern in Linux?

I have folder which contains many .mkv files that I'd like to rename without having to manually do so. The pattern is this: ... [XVC]_Control_-_10_-_Doctors_[SCB055Y].mkv [XVC]_Control_-_11_-...
  • 1,484
0 votes
1 answer
42 views

Randomize GIF JPEG and WEBP Filenames

I have a script that randomizes filenames with the JPEG extension: #!/bin/bash for img in *.jpg; do newname=$(head /dev/urandom | tr -dc a-z0-9 | head -c 8) mv "$img" "$newname"....
  • 2,265
10 votes
3 answers
5k views

What is the practical purpose of "./" in front of relative file paths (in the output from "find")?

Why are some relative file paths displayed in the form of ./file, instead of just file? For example, when I do: find . I get this output: ./file1 ./file2 ./file3 What is the practical purpose, other ...
1 vote
2 answers
55 views

grep -v [string] for whole folder

I have a folder, /path/ , with files all formatted to .filetype, and I am looking to perform: grep -v [string] [filename] > [filename copy].filetype for ALL items in this folder. I assume I'll ...
  • 13
0 votes
1 answer
58 views

Samba translates "::" in directory names to strange string

Samba automatically translates directory names containing :: to some weird string, and there is no direct mapping to a Unix name. Example: ddrs04ia::ip76xddrshared_hiphdk_lay::...
0 votes
0 answers
47 views

Basename of the root directory: why does it return the root directory itself?

basename / returns /, but the manpage says Print NAME with any leading directory components removed. Certainly / is a leading directory component and has not been removed. What's the rationale behind ...
  • 141
0 votes
1 answer
91 views

How do I extract the filename from a path in Awk if I have different length filenames with a path? [duplicate]

I have an Awk script that counts the average of rows from every file from a given directory and its subdirectories and I have to print the filename and the average from a file like this example.c : 5 ...
11 votes
6 answers
2k views

How to XOR two expressions of `test`?

I need to check that a directory (let's call it dir) contains one of two files (let's call them filea and fileb), but neither none nor both. The ideal solution would be to use a XOR operation between ...
  • 858
16 votes
4 answers
3k 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
65 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
71 views

How to find (and move) all duplicate file names [duplicate]

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
142 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 ...
  • 375
3 votes
1 answer
442 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 "$...
  • 135
0 votes
1 answer
111 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, ...
  • 1
-2 votes
1 answer
72 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 ...
  • 250
-1 votes
2 answers
151 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
83 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
893 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
446 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 ...
  • 115
0 votes
1 answer
27 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 ...
  • 61
0 votes
5 answers
166 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
1k 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 ...
  • 85
2 votes
2 answers
102 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'...
  • 360
-1 votes
2 answers
416 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
241 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, ...
2 votes
1 answer
2k 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 ...
  • 121
5 votes
3 answers
312 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 ...
  • 1,483
0 votes
0 answers
28 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 ...
  • 105
0 votes
0 answers
20 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 ...
  • 1,121
5 votes
1 answer
622 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 ...
  • 435
0 votes
0 answers
44 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 ...
  • 785
0 votes
3 answers
184 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
90 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

1
2 3 4 5
24