1
vote
4answers
109 views

Bash Script to Sort Files into Alphabetical Folders on ReadyNAS Duo v1

I have an old ReadyNAS Duo v1 (Sparc) running an unknown flavour of Linux. I have a folder structure with 1,000+ files I want to move into a folder structure based on the first letter of the file ...
4
votes
4answers
142 views

Clean way to temporarily replace a config file?

I use a drawing program called Inkscape, which has both a GUI and a command line interface. When used on the command line, it has a large number of options that can only be controlled through a ...
1
vote
2answers
184 views

How do I trigger a script when a folder is updated in Solaris 5.10?

We are trying to write a script to move away files as soon as they drop in a folder. One way of achieving this is running rsync in a script on cron scheduler. The problem with this approach is the ...
2
votes
1answer
77 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
5answers
146 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
327 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
86 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
352 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
543 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
264 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
1k 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 ...
3
votes
2answers
1k 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 ...
20
votes
1answer
701 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
163 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
86 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
3k 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
304 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 ...