Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 30 Oct 2014, 15:10
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
replacing all the files in a directory with links or blanks
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message

Joined: 29 Nov 2013
Posts: 4

PostPosted: Fri 20 Dec 2013, 00:46    Post_subject:  replacing all the files in a directory with links or blanks  

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.)
Back to top
View user's profile Send_private_message 

Joined: 08 Jun 2005
Posts: 5039
Location: Arizona, U.S.A.

PostPosted: Fri 20 Dec 2013, 01:06    Post_subject:  

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:
cp -sP /path/to/files /path/to/dir

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:
ls /path/to/org/files/* |while read F ;do ln -s /newPath/oneFile /newPath/$F ;done

Try it and see what you get. I`m guessing none of it will work how you think.
Back to top
View user's profile Send_private_message 

Joined: 26 Jan 2011
Posts: 436
Location: Japan

PostPosted: Fri 20 Dec 2013, 03:22    Post_subject:  

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.

 if [ ! "$@" ];then
 gxmessage "\
    Script sets file sizes to 0
    Requires at least 1 filespec as parameter"

 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
Back to top
View user's profile Send_private_message 

Joined: 29 Nov 2013
Posts: 4

PostPosted: Sat 21 Dec 2013, 03:18    Post_subject:  

Thanks. I'll give it a try. I'm pretty sure this will work because you can replace the wavs without crashing it.

(Did I post this in the wrong place? I seem to remember someone saying that, but I'm not seeing it now.)
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

You cannot attach files in this forum
You can download files in this forum

Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0515s ][ Queries: 11 (0.0031s) ][ GZIP on ]