I have a directory with 1858 .wav files. They take up too much space, and I don't want them, but they're used by a program that I want to keep on my Puppy CD. The program can either run them from from the package they originally came from (70 MB) or the directory I've extracted them all to (74 MB).
I've thought up two solutions:
1. Make an empty file in Geany and save it as blank.wav, then replace all 1858 files with copies of blank.wav, named like they're the original files, and repackage them. (Alternately, use an actual audio program to make a blank.wav.)
2. Make a blank.wav by whichever method in the previous solution, and create 1858 links to it with the names of the original files.
Which solution is better, and how do I do it? (Other than doing it by hand, of course.)
replacing all the files in a directory with links or blanks
-
- Posts: 5
- Joined: Sat 30 Nov 2013, 03:32
I`m sure others are wondering also, why do you want to remove them from a CD.?
And what makes you think the app will work without them.? Most apps would fail.
In answer:
This will make links in your new dir that point to the original files.
I`m not sure what this is going to accomplish for you.
To makes links named for original files that all point to one file:
Try it and see what you get. I`m guessing none of it will work how you think.
And what makes you think the app will work without them.? Most apps would fail.
In answer:
Code: Select all
cp -sP /path/to/files /path/to/dir
I`m not sure what this is going to accomplish for you.
To makes links named for original files that all point to one file:
Code: Select all
ls /path/to/org/files/* |while read F ;do ln -s /newPath/oneFile /newPath/$F ;done
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Maybe this works for you. The script reduces files to zero length. I use it to "nullify" mp3 files I don't like which are part of an album (=directory), but which I want to keep as placeholders so the track list (=file list) doesn't change. As my files are sorted by filedate I normally want to keep filedates, so this is possible as an option.
Note that the original files are not "replaced" by blank files but rather reduced to blanks, so any links pointing to these files will not brake.
1. Save the script and make it executable
2. Open ROX and select all files you want to turn into blank files
3. Enter Shift+!, which brings up the shell box at the bottom of the ROX window with the entry "$@"
4. Add the name of your script. The shell box should now read myscript "$@"
5. Press ENTER
Alternatively you can drag the script from ROX to the desktop (to create a shortcut) and then drag your selected files onto the shortcut.
Note that the original files are not "replaced" by blank files but rather reduced to blanks, so any links pointing to these files will not brake.
1. Save the script and make it executable
2. Open ROX and select all files you want to turn into blank files
3. Enter Shift+!, which brings up the shell box at the bottom of the ROX window with the entry "$@"
4. Add the name of your script. The shell box should now read myscript "$@"
5. Press ENTER
Alternatively you can drag the script from ROX to the desktop (to create a shortcut) and then drag your selected files onto the shortcut.
Code: Select all
#!/bin/sh
if [ ! "$@" ];then
gxmessage "\
Script sets file sizes to 0
Requires at least 1 filespec as parameter"
exit
fi
ANSWER=`Xdialog --stdout --check "Keep filedate" "on" --default-no --title "Create Nullfiles, keep dates" --icon "/usr/local/lib/X11/pixmaps/question.xpm" --yesno "Set $# files to zero length?\n\n\n\n" 300x120`
[ $? != 0 ] && exit
for FILE in "$@" ;do
OLDDATE=`stat -c %Y $FILE` # get unix date of current file
OLDDATE=`date -d @$OLDDATE +"%Y%m%d%H%M.%S"` # convert to format compatible with 'touch' command
/dev/null > "$FILE" # reduce filesize to zero (also sets new filedate)
[ $ANSWER = "checked" ] && touch -cht $OLDDATE "$FILE" # apply old filedate
[ $ANSWER = "unchecked" ] && touch -c "$FILE" # Not really necessary, but causes ROX to refresh display
done
-
- Posts: 5
- Joined: Sat 30 Nov 2013, 03:32