Tagged Questions
2
votes
1answer
43 views
tar and if-statement
I have a script that check if a file exist inside a tar file but something's wrong because it always go to the else part of the script. I am pretty sure that it shouldn't be that way.
The date is in ...
2
votes
4answers
56 views
Delete all files in directories except those whose path are listed in a file
Given the following files:
data/A/a.txt
data/B/b.pdf
...
date/P/whatever.log
...
data/Z/z.jpg
I would like to delete all files in the data/A/, data/B/, ..., data/Z/ directories except those files ...
5
votes
3answers
72 views
Maintain (or restore) file permissions when replacing file
I have a command that accepts a file as an argument, modifies the file, then writes it to the file name specified in the second argument. I'll call that program modifyfile.
I wanted it to work "in ...
0
votes
2answers
42 views
Merging multiple lines selectively?
I have a large file in which a header line is followed by a string of characters at multiple times. eg:
file1
VHBFBJBDSBVVFJBSV
SVJBVHJBVJ
SVKJBVJBNVKVJV
file2
dfhgdgffdghgg
SVKJBVJBNVKVJV
I ...
2
votes
3answers
116 views
Replace filename with parent folder name
I have a bunch of files each in their own subdirectory. I need to write a script to rename each file to have the same name as its directory: For example, given:
./1111/1234.pdf
./2222/2345.pdf
...
20
votes
1answer
519 views
How to move a directory, file by file? (instead of “copy then remove”)
My computer has one 500GB drive.
I want to move 400GB of data from /unencrypted to /encrypted.
Both directories are on the same partition, but /encrypted is handled by ecryptfs, so mv /uncrypted/* ...
2
votes
1answer
209 views
Script to check a folder, print the files then delete those files
I am looking for some guidance on creating a script that will check a specific folder, print all documents (if any) and then delete those documents. I would also like to run this script as a cron job. ...
2
votes
1answer
529 views
Create sub-directories and organize files by date
I have some directories of files copied from my security camera that I would like to organize into sub-directories by file date. So for example;
-rwxrwxrwx 0 root root 4935241 Jul 19 2012 ...
2
votes
2answers
636 views
Check whether files in a file list exist in a certain directory
The runtime arguments are as follows: $1 is the path to the file containing the list of files
$2 is the path to the directory containing the files
What I want to do is check that each file listed in ...
18
votes
1answer
586 views
How to implement a horizontal cat? [duplicate]
Standard cat concatenates files line by line (row by row, if you will). I find myself needing a horizontal cat command more and more often recently; i.e. a command that takes a list of files and ...
1
vote
1answer
133 views
TeXstudio: open file at line number n
I am creating a script to produce some .tex files with a lot of lines (a kind of automatic sample).
The script finishes with texstudio /home/$USER/foo.tex where foo.tex is the file created before.
...
4
votes
1answer
77 views
Transform directory structure
I have the following folder structure
root folder
|-al2
|- GER.zip
|- ENG.zip
|-ww
|- GER.zip
|- ENG.zip
and so on. The folder names are random strings.
I want to sort the files in ...
0
votes
2answers
1k views
How to calculate in linux number of file inside nested directories?
I need to extract information how much files are in some directory tree:
/.../testRoot/test1/test11/..../file1
/.../testRoot/test1/test11/file2
/.../testRoot/test1/test11/..../file3
...
2
votes
3answers
2k views
How to delete the oldest directory in a given directory? [duplicate]
Possible Duplicate:
Shell script for moving oldest files?
I have a backup directory that stores x other directories that require backuping.
I need something that will run before another ...
2
votes
2answers
241 views
Comparing files and their properties
I get information of a certain set of files in my mail every day, which looks like this:
58623208 Sep 14 20:08 blbn_blfbe_drv
57904920 Sep 14 19:54 blbn_cycmn
55814208 Sep 14 06:02 clsa_Upd
38912000 ...