On 04/28/2013 12:43 PM, eryksun wrote:
On Sat, Apr 27, 2013 at 9:51 PM, Dave Angel <da...@davea.name> wrote:
And another little-known fact -- NTFS supports hard links, or at least it
did in 1995, on NT 3.5 As I recall, there wasn't support at the cmd prompt,
but you could create them with system calls.
NTFS has always supported hard links as additional $FILE_NAME
attributes in the MFT file record, but it was primarily meant for the
POSIX subsystem. I did find a Win32 solution for NT 3.x, which may be
what you're recalling. It requires 3 calls to BackupWrite in order to
write a link (i.e. a $FILE_NAME attribute) to an existing file record.
Apparently this was documented by Microsoft circa '96, but the
original article no longer exists online. For an example see
CreateHardLinkNt4() here:
http://cpansearch.perl.org/src/AUDREYT/Win32-Hardlink-0.11/lnw.cpp
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
My apologies for not responding, Dave's insight resolved my problem
instantly. I am now having problems with a function I've made that is
supposed to run a find on the media root dir and symlink anything that
was downloaded within a specific amount of days, here is the code:
#!/usr/bin/env python
import os
from sys import argv
import subprocess
script, media = argv
# This is the directory you will sync the symbolic links from, to the
device.
loadDir = "/opt/data/music/load/"
# Root dir of the media
musicDir = "/opt/data/music"
# This is the destination folder, whatever folder the device is mounted to.
destDir = "/media/rev/MOT"
# Get the current working directory
origDir = os.getcwd()
# Glob the current working directory and the "media" argument together
# to form a full file path
origFul = os.path.join('%s' % origDir, '%s' % media)
linkDir = ['ln', '-s', '%s' % origFul, '%s' % loadDir]
# Command to sync if media == "push"
syncCom = "rsync -avzL %s %s" % (loadDir, destDir)
def sync_new():
durFind = raw_input("Enter the duration of time in days you want to
link")
durFind = int(durFind)
fileExcl = "*torrent*"
linkNew = ['find', '%s' % musicDir, '-maxdepth 2', '-mtime %s' %
durFind, '-not', '-name', '%s' % fileExcl, '-exec addsync {} \;']
subprocess.call(linkNew)
def link():
print "Adding %s to %s..." % (origFul, loadDir)
subprocess.call(linkDir)
def sync():
print "Syncing the contents of %s to %s" % (loadDir, destDir)
subprocess.call(syncCom, shell=True)
if media == "push":
sync()
elif media == "pushnew":
sync_new()
else:
link()
Running the script with the pushnew argument results in the following
error from find:
find: unknown predicate `-maxdepth 2'
I'm thinking this is also related to my usage of subprocess? I just
started carving this out right now so I'm still debugging but if anyone
sees anything obvious I would appreciate it.
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor