Sponsored Content
Top Forums UNIX for Advanced & Expert Users Watch directory and move specific file extensions Post 302440003 by STOIE on Sunday 25th of July 2010 08:06:20 PM
Old 07-25-2010
Watch directory and move specific file extensions

Hi all,

This is actually more for my lazyness then anything else, but I think others might find it useful to use as well. Basically this is what I am trying to achieve...

In my ubuntu home dir under Downloads is where firefox saves everything by default, now I know that you can manually specify anywhere that you want things saved to but, this would just be not lazy enough as I love the convenience of hitting download etc.

So, I have created a basic little mv script that moves certain file types out and sorts them in directories throughout my home dir. ie. .torrent files get placed in a directory called Torrents, avi/mpg/wmv get placed in Videos and .mp3 get placed in Music (hmm gotta take that further also).

So, currently this script is just running as a every minute cron, however, this still isn't soon enough, I want it to be instant! using watch or sumthing like that. Problem is I use uTorrent webUI and when I save a file I go to upload it through the interface but it isn't in the torrents directory yet, so I go back to the Downloads folder but it's now moved... gets rather annoying.

So yeah if anyone can help me out on how to watch a directory for files and when something matches criteria (ie. .mp3) then move it to directory X, would be mighty appreciated.

Thanks,
Aaron.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Move a file from windows directory to unix directory

Move a file from windows directory to unix directory, is this possible? if it is, can someone help me on this? Thanks! God bless! (1 Reply)
Discussion started by: kingpeejay
1 Replies

2. Shell Programming and Scripting

file extensions in a directory structure

Hi, I have a huge directory structure with multiple directories and subdirectories in each of the directory. i am trying to find the various file extensions in the directory structure and put them into a file. is there any way through which i can accomplish this (4 Replies)
Discussion started by: itsritish
4 Replies

3. Shell Programming and Scripting

Move the latest or older File from one directory to another Directory

I Need help for one requirement, I want to move the latest/Older file in the folder to another file. File have the datetimestamp in postfix. Example: Source Directory : \a destination Directory : \a\b File1 : xy_MMDDYYYYHHMM.txt (xy_032120101456.txt) File2: xy_MMDDYYYYHHMM.txt... (1 Reply)
Discussion started by: pp_ayyanar
1 Replies

4. Shell Programming and Scripting

List directory name (only once) after multiple file extensions found

Here is a simplified example of my problem. Say I have the following 3 sub-directories; ./folder1 A.txt A.sh ./folder2 B.txt ./folder3 C.txt C.sh I would like to list the directory names which contain both '.txt' & '.sh' type extensions. I have came up with the following code;... (8 Replies)
Discussion started by: mmab
8 Replies

5. UNIX for Dummies Questions & Answers

look for file size greater than "0" of specific pattern and move those to another directory

Hi , i have some files of specific pattern ...i need to look for files which are having size greater than zero and move those files to another directory.. Ex... abc_0702, abc_0709, abc_782 abc_1234 ...etc need to find out which is having the size >0 and move those to target directory..... (7 Replies)
Discussion started by: dssyadav
7 Replies

6. Shell Programming and Scripting

Remove comments from file with specific file name extensions

Hello Unix board community, I have to program a shell script, but I am a complete noob so I hope I get some help here. The assignment is as follows: The program removes all comments regardless of formatting or language from files with specific file name extensions (php, css, js, ...).... (3 Replies)
Discussion started by: TheZeusMan
3 Replies

7. Shell Programming and Scripting

Shell scripting-I need a script which should watch a directory for a file with specific directory

I need a script which should watch a directory for a file with specific directory. If it finds a file in directory, it should search for few specific keyword in the file. if the keyword exists, it should trim string from specific column. The file should be moved to another directory and the a... (8 Replies)
Discussion started by: akashdeepak
8 Replies

8. Shell Programming and Scripting

Move specific folders and subfolders in a directory

I am trying to move specific folders and subfolders within a directory using the below. I can see the folders to move and they are at the location, but I am getting an error. Thank you :). mv -v /home/cmccabe/Desktop/NGS/API/6-10-2016{bam/{validation,coverage},bedtools /media/cmccabe/"My... (6 Replies)
Discussion started by: cmccabe
6 Replies

9. Shell Programming and Scripting

Shell script cannot create directory and move the file to that directory

I have a script, which is checking if file exists and move it to another directory if then mkdir -p ${LOCL_FILES_DIR}/cool_${Today}/monthly mv report_manual_alloc_rpt_A_I_ASSIGNMENT.${Today}*.csv ${LOCL_FILES_DIR}/cool_${Today}/monthly ... (9 Replies)
Discussion started by: digioleg54
9 Replies

10. Shell Programming and Scripting

Bash to move specific files to directory based on match to file

I am trying to mv each of the .vcf files in the variants folder to the folder in /home/cmccabe/f2 that the .vcf id is found in file. $2 in file will always have the id of a .vcf in the variants folder. The line in blue staring with R_2019 in file up to the -v5.6 will always be an exact match to a... (4 Replies)
Discussion started by: cmccabe
4 Replies
TRANSMISSION-CLI(1)					    BSD General Commands Manual 				       TRANSMISSION-CLI(1)

NAME
transmission-cli -- a bittorrent client SYNOPSIS
transmission-cli -h transmission-cli [-b | -B] [-d number | -D] [-er | -ep | -et] [-f script] [-g directory] [-h] [-m | -M] [-p port] [-t] [-u number | -U] [-v] [-w directory] torrent-file DESCRIPTION
The transmission-cli program is a lightweight, command-line BitTorrent client with scripting capabilities. The options are as follows: -b --blocklist Enable peer blocklists. Transmission understands the bluetack blocklist file format. New blocklists can be added by copying them into the config-dir's "blocklists" subdirectory. -B --no-blocklist Disble blocklists. -d, --downlimit number Set the maximum download speed in KB/s -D, --no-downlimit Don't limit the download speed -er --encryption-required Encrypt all peer connections. -ep --encryption-preferred Prefer encrypted peer connections. -et --encryption-tolerated Prefer unencrypted peer connections. -f, --finish script Set a script to run when the torrent finishes -g, --config-dir directory Where to look for configuration files. This can be used to swap between using the cli, daemon, gtk, and qt clients. See http://trac.transmissionbt.com/wiki/ConfigFiles for more information. -h, --help Prints a short usage summary. -m, --portmap Enable portmapping via NAT-PMP or UPnP -M, --no-portmap Disable portmapping -n, --new sourcefile Create torrent from the specified file or directory -p, --port port Set the port to listen for incoming peers. (Default: 51413) -t, --tos Set the peer socket TOS for local router-based traffic shaping. -u, --uplimit number Set the maximum upload speed in KB/s -U, --no-uplimit Don't limit the upload speed -v, --verify Verify the torrent's downloaded data. -w, --download-dir directory Where to save downloaded data. SIGNALS
In addition to these options, sending transmission-cli a SIGHUP signal will contact the tracker for more peers. ENVIRONMENT
TRANSMISSION_HOME Sets the default config-dir. http_proxy libcurl uses this environment variable when performing tracker announces. FILES
~/.config/transmission Directory where transmission-cli keeps torrent information for future seeding and resume operations. AUTHORS
The transmission-cli program was written by Eric Petit, Josh Elsasser, Jordan Lee, and Mitchell Livingston. SEE ALSO
transmission-create(1), transmission-daemon(1), transmission-edit(1), transmission-gtk(1), transmission-qt(1), transmission-remote(1), transmission-show(1) http://www.transmissionbt.com/ BSD
July 21, 2008 BSD
All times are GMT -4. The time now is 11:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy