![]() |
|
Register | FAQ | The Twelve Commandments | Members List | Calendar | Arcade | Find the Best VPN | Search | Today's Posts | Mark Forums Read |
Download/Upload Problems Problems with downloading or uploading files through the Gnutella network. * Please specify whether the file problem is a Gnutella network shared file OR a Torrent file. * |
| LinkBack | Thread Tools | Display Modes |
| |||
![]() Well, I got sick and tired of watching a nearly finished download stall, then restart under a slightly different name, even when the file sizes were exactly the same. Jeez, this should just work. So here's a bit of a hack solution: this is a simple shell script that will create symbolic links of all files that share the same prefix with the target file that you specify. In other words, you type: combine.sh "T-98721-Some Thing.file" and every file that has the same "T-XXXXX" will be deleted (or moved, if you want to play it safe) and a symbolic link will be created in its stead. All you need to do is supply the filename of your target. I haven't fully tested this out to see if it works without introducing artifacts, so be forewarned. Oh, and this is for Linux, sorry to Windows users, but it should also work under OSX if you have bash. I'd appreciate comments and improvements to **EDIT EMAIL ADDRESS** Good luck. -----BEGIN SCRIPT----- #!/bin/bash # This file is used to link similar files to a target file. It is # intended to be used with Limewire to facilitate downloads. function print_usage { echo "Usage: $( basename $0 ) [-s] filename" echo -e "\t-s\tbackup files" echo "Remember to surround files that include whitespace with quotes" exit $E_WRONGARGS } TARGET=temp # Target file to link to PREFIX=temp # Prefix of target file used for search SAFEMODE=false # Indicate whether to backup files E_WRONGARGS=65 # Improper arguments E_NOTARGET=66 # Target file does not exist E_NODELETE=67 # Cannot delete file E_NOMOVE=68 # Cannot move file E_NOLINK=69 # Cannot link files # Save stdin exec 6<&0 # Test for appropriate arguments if [ -z "$1" ]; then print_usage elif [ "$1" = "-s" ]; then if [ -z "$2" ]; then print_usage else SAFEMODE=true TARGET="$2" fi else TARGET="$1" fi # Test for existence of target file if [ ! -f "$TARGET" ]; then echo "Target file does not exist" exit $E_NOTARGET fi # Create backup directory if applicable if [ "$SAFEMODE" = "true" -a ! -d "backup" ]; then mkdir backup if [ ! "$?" ]; then echo "Cannot create backup directory" echo "Check directory permissions" exit $E_FAILBACKUP fi fi # Strip prefix from target file PREFIX=$( echo $TARGET | cut -d- -f1,2 - ) # Perform search for prefix and store in a temp file ls | grep $PREFIX > files.temp # Change stdin to files.temp and begin processing exec < files.temp read FILE while [ ! -z "$FILE" ]; do if [ "$FILE" != "$TARGET" ]; then if [ "$SAFEMODE" = "false" ]; then rm -f "$FILE" if [ ! "$?" = "0" ]; then echo "Unable to delete $FILE" echo "Check permissions" echo "Exiting" exit E_NODELETE fi else mv "$FILE" ./backup/ if [ ! "$?" = "0" ]; then echo "Unable to move $FILE" echo "Check permissions" echo "Exiting" exit E_NOMOVE fi fi ln -s "$TARGET" "$FILE" if [ ! "$?" = "0" ]; then echo "Unable to link files" echo "Check permissions" echo "Exiting" exit E_NOLINK fi fi read FILE done # Restore stdin exec 0<&6 6<&- rm -f files.temp echo "Done" exit 0 -----END SCRIPT----- Just copy and paste it into a file like: combine.sh, make it executable with chmod 777 combine.sh, and place it in /usr/local/bin or whatever. Last edited by Remoc; March 8th, 2009 at 08:35 AM. |
Thread Tools | |
Display Modes | |
| |
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Resuming downloads | ...kleim | Download/Upload Problems | 13 | August 19th, 2005 01:31 PM |
Resuming Downloads | dimagor | Download/Upload Problems | 1 | January 21st, 2002 05:43 PM |
Resuming Downloads | Paul | Gnotella (Windows) | 2 | June 1st, 2001 07:38 PM |
Resuming downloads | jacmac | Gnotella (Windows) | 6 | May 28th, 2001 08:19 AM |