I'm trying to set up a script that will go through my Music File directory and generate a set of symbolic links in a directory called "What's New". Within that directory there will be a "30 Days", "3 Months", "6 Months" and "A Year" directories. Within each of those my script should create symlinks based on the mtime of the directories that the 'find' command returns. The general reason for me doing this is that I've been downloading stuff from emusic.com and sometimes I find myself forgetting what I downloaded. Having a directory with "fuzzy" time references would go a long way to helping me remember. So I wrote the script below which almost does what I need. But it has one HUGE glaring error. For some reason, the 'ln' command creates a self referencing symlink within the trailing directory for each directory that matches my mtime arg. So once it's done, I have what I want in the "What's New" directory. But for every directory that 'find' returns I have a symlink in the last directory in the path that points to itself. I'm sure there's something stupid I'm missing in my logic with the 'ln' command. Just to make sure I'm clear, let's say my script finds a directory less than 31 days old:
/mnt/data/mp3/The Rolling Stones/Sticky Fingers
I get the symlink I want in:
/mnt/data/mp3/What's New/30 Days/The Rolling Stones/Sticky Fingers
pointing to:
/mnt/data/mp3/The Rolling Stones/Sticky Fingers
And I also get a new, unwanted symlink in:
/mnt/data/mp3/The Rolling Stones/Sticky Fingers/Sticky Fingers
pointing to:
/mnt/data/mp3/The Rolling Stones/Sticky Fingers
Obviously this is not what I want. So either I'm looping in the wrong way, or I'm making an incorrect assumption about the 'ln' command. I have to admit this is a pretty sloppy script, but I haven't had enough free time to really sit down and really set it up with internal functions. Here's my script:
Hi,
I use rsync to move from source to target, but there are cases that I need to exclude:
Suppose in my file system, I have a soft link ~/data -> /media/volgrp/data.
Under data folder, there is a file hello.txt.
After moving command "rsync --remove-source-files -aH --force ~/data/... (3 Replies)
So i have read the man pages a few time. Searched google but I am not quite sure i understand all the lingo.
What i want to do is list all files on / except i dont want any symlinks (because if I am searching / I will find the "true" file...correct?)
So there is the -P, -H, and '-type l'... (2 Replies)
Hi,
My first post here:
Was looking if someone can help enhancing my code.
I am limited to sh or ash shell (android / busybox)
I made a script to look for busybox symlinks, backup them and delete them
I have these questions about the below code:
- busybox tar do not has the options... (2 Replies)
Ive got multiple PCs, sharing an NFS mounted home dir. For certain apps I would like to keep the config files host specific. Easy solution is to create symlinks to local folders for configs. Ideally I would still want the .config files to reside in the user home folder.
Is it possible to... (2 Replies)
Hello,
I have inherited an old Solaris box and I have to copy all of its files onto another machine, a Centos Box. The Solaris box it so ancient is does not have rsync, scp or any other useful copy functions. I tried using RCP but it handles symlinks terribly: Extraneous data is written to my... (1 Reply)
I need to have my script know what directory it's in, even if it's run from a symlink located elsewhere. Here's what I've come up with, for the benefit of anyone with a similar need, but I'm also interested to know if there's a more elegant solution. I'd rather not get into awk-land, but I couldn't... (2 Replies)
I create the tar file from / like so:
tar cEhf name.tar usr/us
And this creates the tar with the links intact. The problem is that this tar is going to be used for testing, so we want the links to point to the files in the tar. But when I extract the tar into /tmp, I get /tmp/usr/us/... as I... (2 Replies)
Hi,
In my shell programming, When i copy sym links from one server to another server using rsync it does not preserve time stamp . it showing current time after copying in destination server.the command i used is
rsync -vaR --
How can i preserve sym links time stamp using rsync.
Thanx (1 Reply)
Hello All,
Assuming i have a thousand symlinks under directory /mydir (and its sub-dir) such as:
mysymlink1 -> ../../../myfoo/mysymlink1
mysymlink2 -> ../../../myfoo/mysymlink2
How can I search the string "myfoo" and replaced with "yourfoo" such that after the operation is complete the... (2 Replies)