diff -r 7685cec9fd3c -r f2ddfa555b0f doc/api/python/fileutils-module.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/api/python/fileutils-module.html Fri Sep 11 11:54:49 2009 +0100 @@ -0,0 +1,674 @@ + + + + + fileutils + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Module fileutils + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module fileutils

source code

+
+
File manipulation related functionalities:
+
+
+


+ + + + + + + + + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + AbstractScanner
+ This class implements all the required infrastructure for filescanning. +
+   + + FileScanner
+ Scans the filesystem for files that match the selection paths. +
+   + + LockFailedException +
+   + + Lock +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
move(src, + dst)
+ Recursively move a file or directory to another location.
+ source code + +
+ +
+   + + + + + + +
rmtree(rootdir)
+ Catch shutil.rmtree failures on Windows when files are read-only.
+ source code + +
+ +
+   + + + + + + +
destinsrc(src, + dst)
+ Fixed version of destinscr, that doesn't match dst with same root name.
+ source code + +
+ +
+   + + + + + + +
which(executable)
+ Search for executable in the PATH.
+ source code + +
+ +
+   + + + + + + +
read_policy_content(filename)
+ Read the policy number from the policy file.
+ source code + +
+ +
+   + + + + + + +
load_policy_content(filename)
+ Testing policy content loading.
+ source code + +
+ +
+   + + + + + + +
guess_encoding(data)
+ Given a byte string, guess the encoding.
+ source code + +
+ +
+   + + + + + + +
getmd5(fullpath, + chunk_size=2**16)
+ returns the md5 value
+ source code + +
+ +
+   + + + + + + +
read_symbian_policy_content(filename)
+ Read the policy category from the policy file.
+ source code + +
+ +
+   + + + + + + +
get_next_free_drive()
+ Return the first free drive found else it raise an exception.
+ source code + +
+ +
+   + + + + + + +
subst(drive, + path)
+ Substing path as a drive.
+ source code + +
+ +
+   + + + + + + +
unsubst(drive)
+ Unsubsting the drive.
+ source code + +
+ +
+   + + + + + + +
mount(drive, + unc, + username=None, + password=None, + persistent=False)
+ Windows helper function to map a network drive.
+ source code + +
+ +
+   + + + + + + +
umount(drive)
+ Windows helper function to map a network drive.
+ source code + +
+ +
+   + + + + + + +
rmdir(path) + source code + +
+ +
+   + + + + + + +
remove(path) + source code + +
+ +
+   + + + + + + +
touch(srcdir)
+ Recursively touches all the files in the source path mentioned.
+ source code + +
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + LOGGER = logging.getLogger('fileutils') +
+   + + LOGGER_LOCK = logging.getLogger('fileutils.lock') +
+   + + ENCODING_MATRIX = {codecs.BOM_UTF8: 'utf_8', codecs.BOM_UTF16:... +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

move(src, + dst) +

+
source code  +
+ +

Recursively move a file or directory to another location.

+

If the destination is on our current filesystem, then simply use +rename. Otherwise, copy src to the dst and then remove src. +A lot more could be done here... A look at a mv.c shows a lot of +the issues this implementation glosses over.

+
+
+
+
+ +
+ +
+ + +
+

rmtree(rootdir) +

+
source code  +
+ + Catch shutil.rmtree failures on Windows when files are read-only. Thanks Google! +
+
+
+
+ +
+ +
+ + +
+

read_policy_content(filename) +

+
source code  +
+ + Read the policy number from the policy file. +strict allows to activate the new policy scanning. +
+
+
+
+ +
+ +
+ + +
+

guess_encoding(data) +

+
source code  +
+ +

Given a byte string, guess the encoding.

+

First it tries for UTF8/UTF16 BOM.

+

Next it tries the standard 'UTF8', 'ISO-8859-1', and 'cp1252' encodings, +Plus several gathered from locale information.

+

The calling program must first call locale.setlocale(locale.LC_ALL, '')

+

If successful it returns (decoded_unicode, successful_encoding) +If unsuccessful it raises a UnicodeError.

+

This was taken from http://www.voidspace.org.uk/python/articles/guessing_encoding.shtml

+
+
+
+
+ +
+ +
+ + +
+

touch(srcdir) +

+
source code  +
+ + Recursively touches all the files in the source path mentioned. +It does not touch the directories. +
+
+
+
+
+ + + + + + +
+ + + + + +
Variables Details[hide private]
+
+ +
+ +
+

ENCODING_MATRIX

+ +
+
+
+
Value:
+
+{codecs.BOM_UTF8: 'utf_8', codecs.BOM_UTF16: 'utf_16', codecs.BOM_UTF1\
+6_BE: 'utf_16_be', codecs.BOM_UTF16_LE: 'utf_16_le',}
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + +