Tagged Questions
3
votes
3answers
77 views
How to move all files with a certain file extension from subdirectories to a single directory
I have a directory that contains many subdirectories. The subdirectories contain lots of types of files with different file extensions. I want to move (not copy) all the files of one type into a new ...
11
votes
5answers
6k views
Script to monitor folder for new files?
How do I detect new files in a folder with a bash script? I would like to process the files as soon as they are created in the folder. Is this possible to do so or do I have to schedule a script with ...
16
votes
3answers
1k views
Clone ownership and permissions from another file?
Is there a command or flag to clone the user/group ownership and permissions on a file from another file? To make the perms and ownership exactly "like" that of another file?
1
vote
1answer
54 views
Standard I/O File Descriptors
I am new to Shell SCripting
I code this
$ ls -l 1> stdout.txt
and I get the output as desired,
1> stdout.txt
redirects the output from standard output to the file stdout.txt.
I don't ...
0
votes
1answer
21 views
File inventories and logrotation
I want to collect a huge amount of data files on my actual netapp storage with the command file - f /path... > logfile.txt.
Through the huge data amount, the size of the logfile will be critical. ...
11
votes
6answers
6k views
How do I can get the size of a file in a bash script?
How do I can get the size of a file in a bash script?
How do I assign this to a bash variable so I can use it later?
5
votes
4answers
2k views
Number of files containing a given string
How can I count the number of files (in a directory) containing a given string as input in bash/sh?
1
vote
2answers
41 views
How to strip directory structure with command line (or script)
I have a large collection of files packed into a two-level directory structure with many, many, many folders.
In other words, I have a folder with a great many subfolders in it. There are no ...
3
votes
2answers
140 views
How to write file into another
I have an empty file (only zeroes are in it) of size 9,0KB and I need to write another file (with size 1,1KB) to it, but the first file must not lose its size or the rest of its contents. So if the ...
3
votes
4answers
171 views
Using GNU Parallel With Split
I'm loading a pretty gigantic file to a postgresql database. To do this I first use split in the file to get smaller files (30Gb each) and then I load each smaller file to the database using GNU ...
1
vote
4answers
67 views
How to find what device a file is on (and use that in a script)?
I want to find out what device my file is on so that I can use it in a script. I can get this far:
$ df .
Filesystem 512-blocks Used Available Capacity Mounted on
/dev/disk0s2 498438976 ...
4
votes
3answers
721 views
shell script to read from multiple files in parallel
I need to write a script that runs parellel and looks for a string in multiple files . I tried a lot of options but they slow down the speed of my processor.
2
votes
2answers
90 views
Matching two files for similar first line
I have 2 set of files.
File one contains ID's
ex:
1111
2222
6666
3333
4444
File two contains ID and username:
1873 Neil
1111 Roger
7632 Tim
3333 Oscar
8723 Greg
4444 Roy
6666 Patrick
I want to ...
3
votes
2answers
179 views
Get the complement of the result of an ls command
Let's say I have a directory with multiple files, all of which are either binary files (files with no declared extensions) and source files (.c extension). I do this:
$ ls
and get:
README.md ...
3
votes
4answers
98 views
Unix - how to fetch files based on the part of a filename that is date
Say I have files say like
AA_XX_20111208
AA_XX_20111207
AA_XX_20111206
AA_XX_20111205
AA_XX_20111204
AA_XX_20111203
So using the date part,
how can i fetch previous 2 month files ?
For e.g. this ...