LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Blogs > ted_chou12
User Name
Password

Notices


Rate this Entry

sync folder script

Posted 02-18-2013 at 09:19 PM by ted_chou12

Hi, not posting for quite a while. I was thinking of synchronizing my portable music mplayers directory with the music directory on the server. But I dont want all the music files, if all the files were synchronized then I would have no space on the player. So I was trying to come up with how I want it to be.
1) I want to synchronize by modify date of the LATEST, that means latest files come first in priority.
2) I want to limit a total file size on the files. NOT the number of files but the total size. Because the number of files simply isn't that accurate.
3) I want don't want to overwrite, but I do want to delete obsolete files (to provide space for the updated ones).

So far I have
Code:
#/bin/sh

storage=1000000
bytes=0

files=$(find . -type f  -printf "%T+\t%p\n" | sort -r | sed 's:^.*\s./::i')
IFS="
"
files1=$files

for file in $files1 ; do
	if [ $bytes -lt $storage ] ; then
		filesize=$(wc -c "./$file" | awk '{print $1}')
		bytes=$((bytes+filesize))
		echo "$bytes"
	else
		break
	fi
done
I am still writing...
Ted
Posted in Uncategorized
Views 4786 Comments 1
« Prev     Main     Next »
Total Comments 1

Comments

  1. Old Comment
    Found this useful info:
    Quote:
    I've created two samba shares, /media/disk1 and /media/disk2
    say the structure is like this:
    /media/disk1/dir1
    /media/disk1/dir2 links to /media/disk1/dir1
    /media/disk2/dir1 links to /media/disk1/dir1

    so I can access /media/disk1/dir1 and /media/disk1/dir2 from samba share, but I cannot access /media/disk2/dir1, on Windows 7 it throws:

    Quote:
    [Window Title]
    Location is not available

    [Content]
    N:\dir1 is not accessible.

    Access is denied.


    [OK]

    In conclusion, symbolic inside the same drive is okay, but when cross-drive links happened, I cannot access them..
    Is there anything I have missing or done wrongly? Thanks.

    --------------------------------------------------------------------------------
    Last edited by qip; January 10th, 2011 at 07:03 AM..


    qip
    View Public Profile
    Send a private message to qip
    Find More Posts by qip


    January 10th, 2011 #2
    PatchesTheCaveman
    Has an Ubuntu Drip



    Join Date: Oct 2009
    Location: Tucson, AZ
    Beans: 782
    Ubuntu 10.10 Maverick Meerkat Re: samba share cannot access symbolic links to other drives

    --------------------------------------------------------------------------------

    You need to set

    Code:
    follow symlinks = yes
    wide links = yesfor the share in smb.conf for Samba to follow symlinks out of the file share.

    ETA: You will also need to add:

    Code:
    unix extensions = noto your [global] sections for security reasons. For more information, see http://www.ubuntu.com/usn/usn-918-1
    http://ubuntuforums.org/showthread.php?t=1663694
    Posted 02-19-2013 at 04:44 AM by ted_chou12 ted_chou12 is offline
 

  



All times are GMT -5. The time now is 05:18 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration