Use this tag for questions about file management and operations on files.

learn more… | top users | synonyms (1)

0
votes
1answer
50 views

How do I do a long listing of files and only show those that are a certain size?

I need to show a long listing of files in a directory but only those that are a certain size in bytes. Can someone tell me how to do this?
0
votes
1answer
22 views

Append one file to two files in unix script [duplicate]

I need to append one trail record to both the files. cat file1 >> file2 this appends everything in file1 to file2 My requirement is to append to file1 content to both file2 and file3.
1
vote
1answer
46 views

Running command on multiple files within multiple directories

I want to run the command python quast.py -o quast contigs.fasta but I want to do this for multiple contigs.fasta files in multiple directories. I'm running OSX.
2
votes
2answers
77 views

Move file/table by averaging a column

I have the following program that allows me to move a file (actually a table) if the value of the first line of the fourth column is the highest one (in comparison with 8 other files having the same ...
1
vote
3answers
122 views

Change name of directories and included file

In a directory I have several sub-directories named as follow (the [1-9] means going from 1 to 9): AA_BB_CC_river[1-9] Each sub-directories contains a file (ascii) having exactly the same name as ...
-1
votes
1answer
53 views

Looping through files in directories, each matching a pattern [closed]

I want to loop over files matching *.pdf, in the directories matching [A-J]*? I don't understand what is unclear about this question that resulted in putting it on hold.
4
votes
2answers
128 views

Test for existence of multiple files, given by pipe

I have a command that gives me a list of files, one on each line. Filenames are "normal" - no spaces, no need to escape parentheses etc. Now I want to pipe that command to something like test -f and ...
2
votes
5answers
77 views

Looping through a file using a column

I am trying to loop through a file named file.txt that contains a bunch of junk and one column (column #4) I am interested in. I want this loop to run from 0 to eof. For each value in column 4, I want ...
3
votes
2answers
64 views

How to keep exactly one file in a directory?

I have recovered files and currently they have this structure: root/MD5_of_file1/file1 root/MD5_of_file2/file2 ... root/MD5_of_filen/filen Obviously, duplicates are now in the same folder. The ...
3
votes
3answers
103 views

Find and replace with contents of a file

I have a file that begins with a few "include" statements, like this: include foo.xyz include bar.xyz do c do d Suppose the file foo.xyz contains do a and the file bar.xyz contains do b. How can I ...
5
votes
1answer
81 views

How to find the most frequent word of each file in a directory?

I need to find the most frequent word of each file in a directory and print it like this : 12 my /home/test/file1.txt 5 you /home/test/file3.txt 7 hello /home/test/file4.txt I tried: for tmp in ...
2
votes
2answers
112 views

File merging - same name, different extension

How would you merge different input .txt and .tsv files (within a directory) who have the same name but a different extension into an output file? Input: file1.txt, file2.txt, file1.tsv, file2.tsv ...
1
vote
1answer
20 views

Making a fasta file from 2 different files

I have 2 files file1.seq and file2.seq. They look like these: file1.seq ACGGTGTGATG file2.seq CGTGATGATGT I want to make one fasta file which would be like: >file1.seq ACGGTGTGATG ...
3
votes
3answers
249 views

sudoer file how to give a particular user full access to only certain file

I want to give a user full access to only certain files, can someone show me how to do that? For example, I want to modify the sudoer file to grant user access to only certain file. Thanks.
1
vote
1answer
77 views

Force nautilus desktop to open files with another file manager

I'm using Elementary OS Freya (which is based on Ubuntu), with nautilus to manage the desktop. Is there a way to force nautilus desktop icons to open files with another file manager (PCManFM in this ...
0
votes
0answers
18 views

Where does KVM hypervisor store VM files?

For a guest machine how can I know where the files created in vm (not the VM config files but actual files which I create while using VM) are stored on my host machine? To which directory of my host ...
2
votes
1answer
28 views

How to reuse file pattern in .gitignore in bash/zsh?

Here is the content of the .gitignore cron.yaml build target webview *.pyc *.sublime-workspace .idea *.rej .coverage app/tools/temp_*.py app/tools/*/temp_*.py I am currently iteraring files in a ...
1
vote
1answer
61 views

Compare 2 Columns in 2 different files

I need to subtract second and third columns between 2 files based on the first column and do not show rows with diff_column_2(DIFF-IO)=diff_column_3(DIFF-SELECT)=0. Noting that the order can be random ...
2
votes
1answer
30 views

ACL group permission still not allowing write permissions

There's a file called '/etc/file.conf' on my filesystem. $ getfacl /etc/file.conf getfacl: Removing leading '/' from absolute path names # file: etc/file.conf # owner: root # group: root user::rw- ...
80
votes
6answers
6k views

How are “/dev” Linux files created?

There are special files in Linux that are not really files... The most notable and clear examples of these are in the dev folder, "files" like: /dev/null - Ignores anything you write to the file ...
1
vote
1answer
30 views

Extract entries from a file ranging from one date to another

There is a file which has entries with the first and second field as date and time in the following manner : 2015/10/14 00:33:37. The file has 100,000+ lines and is constantly updated. Entries in the ...
3
votes
4answers
91 views

Moving a list of files by matching them to a destination index

Say I have two text files src.txt and dest.txt, where src.txt contains a list of filenames (some of which include spaces) in /src/dir/ and dest.txt contains, in random order, a list of the complete ...
3
votes
2answers
59 views

How can I list all files, but only in directories that have no subdirectories?

I have a directory tree that I want to search recursively for all files of a certain type (for example all .jpg's), but I only want to list these files if they are at the bottom of a directory tree. ...
4
votes
4answers
147 views

Delete all but the most recent n file for each group of files that share the same prefix in a directory

My question is a bit different from some older questions simply asking for "deleting all but the most recent n files in a directory". I have a directory that contains different 'groups' of files ...
1
vote
3answers
67 views

Printing a line at a specified offset in a file

I have a file with 50 characters on each line and 50 lines. Each line of the file contains arbitrary letters. I want to specify a character sequence number (ex: 52) and have the appropriate line of ...
1
vote
4answers
94 views

Find and delete all same files (by name) between 2 directories

I want to find all files in dir1 having corresponding same file names in dir2, and delete them from dir1. For example: dir1: first.txt second.txt dir2: third.txt first.txt So I want to remove from ...
2
votes
2answers
49 views

Find and replace all same files between 2 directories

I want to find all files in dir1 having corresponding same file names in dir2, and replace them with the files from dir2. For example: dir1: first.txt second.txt dir2: third.txt first.txt So I ...
1
vote
1answer
23 views

Group Directory permission

you have been asked by couple of programmers to make ProjectA a group directory on a UNIX server which allows them to create files under that directory to facilitate collaborative work, but only the ...
1
vote
1answer
105 views

md5sum for every file (with ll)

I want output like this: name size and hash: myfile.txt 222M 24f4ce42e0bc39ddf7b7e879a mynewfile.txt 353M a274613df45a94c3c67fe646 For name and size only I have ll -h | awk '{print ...
2
votes
0answers
39 views

Unable to insert records on sqlite on a Linux environment

I tested a simple Php program using Sqlite3 instead of mySQL on my own computer and it works fine. What the program does is simple insert of record into a certain table. Now, when I try to do that on ...
1
vote
1answer
64 views

How to grep several files using part of filename as a pattern?

I have a folder which includes several files named order[ID].log where [ID] is a string e.g. orderID1.log orderID2.log orderID3.log orderID4.log ... I need to write a script in Linux to grep each ...
3
votes
3answers
429 views

Delete all files in a folder except the last (most recent) 20 [duplicate]

I want to remove all the files from different directories, and want to keep only latest files 20 files. is this the correct command to do this? ls -t1 /mnt/dwh/ftp/dwh_ftp_cbs/ARLOGS/ | tail -n +22 | ...
1
vote
4answers
122 views

Changing column of multiple csv files

I have a csv file called scenario1.csv in which the second column has column names like "0-4 years high risk", "65+ years first responder" etc. There are 20 such values. The 21st row, 2nd column has ...
2
votes
1answer
54 views

How to make files unmodifiable and undeletable without `chattr`?

I (and my collaborators) have a directory tree containing ~160K files (most of them are automatically generated by data gathering instrumentation). These files reside in a system that gets backed up ...
2
votes
1answer
26 views

combining output from different scripts into different files in a loop

First of all: I hope the question is comprehensible, otherwise please let me know and I will do my best to make it more clear. This is a follow up to Replace one entire column in one file with a ...
-1
votes
1answer
142 views

Linux folder size limit

We are using below code to create folder in Linux server. File dir = new File(filePath); if(!dir.isDirectory()) dir.mkdirs(); After that creating files inside that ...
2
votes
0answers
25 views

How to set EMIRGE program to write files with desired permission

How can I get the EMIRGE program to read certain files? I am using Linux Mint (17.1). I have downloaded a program call EMIRGE, which is supposed to take fastq files (a text file format for ...
0
votes
2answers
25 views

Search for a non exact match and return column 1 of that file

I have a tab seperated file which looks like this: Adam Group1,Group2,Group8,Group9,Group10 James Group1,Group11,Group12,Group7 Kelly Group18 Alfred Group1,Group8,Group10 Manuel ...
2
votes
3answers
48 views

Recursively delete files with 'WIDTHxLENGTH' in the name in a directory

I have a directory that has subdirectories, and I want to delete images named like thumbnail-name_WIDTHxLENGTH.{jpg,png}, where WIDTH and LENGTH are both decimal integers, like box-image-150x150.jpg ...
1
vote
3answers
131 views

Move files up by a directory by depth criteria

I have a directory tree that looks like this (simplified, in truth there are hundreds of folders): . ├── a │   └── b │   └── a.h5 ├── b │   ├── b │   │   └── e.h5 │   └── c │   ├── a.h5 │   ...
0
votes
5answers
93 views

Find all [filename].mp4 and rename [filename].audio [duplicate]

So I have a script that adds 2 films together using the audio from the $1.audio file. What I would like to do is rename any file in the directory with: *.mp4 To: *.audio Keeping original file ...
4
votes
3answers
223 views

How do I find all square images in a directory

The images are stored in JPEG and PNG files. I want to get a list of those of them that are square.
0
votes
2answers
28 views

changing the numbering of several files

I have 456 files with the format like aaa_0.plt aaa_2.plt ... aaa_455.plt I want to change them so that the numbers starts from 910 and I would have aaa_910.plt ... aaa_1365.plt
11
votes
5answers
679 views

Test if File was Modified After Date in File Name

I have a files named with YYYYMMDD in the file name, such as file-name-20151002.txt I want to determine if this file was modified after 2015-10-02. Notes: I can do this by looking at the output ...
2
votes
5answers
126 views

Rename files not directories

I want to rename all files to lowercase in a directory without renaming subdirectories. I know rename function but it renames files and subdirectories which is not desired. Can you help?
2
votes
0answers
60 views

I can't delete a file from EFI System Partition

I'm trying to delete a file since I installed rEFInd instead or Grub, I want to remove Grub or just remove "grubx64.efi" from my ESP, to make it disappear in the rEFInd boot screen. I can mount my ...
1
vote
1answer
27 views

How can I update the database of files on the system daily? [closed]

What is the command that I should execute daily to update the database of all files that are on the system?
1
vote
1answer
27 views

Only color files according to file types? [duplicate]

When using ls to list files in a directory, the files are colored according to their access permissions. Is it possible to color the files only according to their file types (e.g. a regular file, a ...
1
vote
5answers
76 views

Remove repetitive entries from a file

There is a file with a couple of identical and repetitive entries, which looks something like this: 123 abc nhjk 123 abc cftr 123 abc xdrt 123 def nhjk 123 def cftr 123 def xdrt If the combination ...
2
votes
1answer
17 views

How can I delete a former MTP directory, which now gives me input/output error whenever I try?

I have ~/srv/mtp, which I do not remember how I created. It was back when I was trying to set up a MTP mountpoint using various tools for that. Currently I can't do anything to the directory. ○ file ...