• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(1076)  |  Call(1023)  |  Derive(0)  |  Import(53)
Recursively move a file or directory to another location. This is
similar to the Unix "mv" command.

If the destination is a directory or a symlink to a directory, the source
is moved inside the directory. The destination path must not already
exist.

If the destination already exists but is not a directory, it may be
overwritten depending on os.rename() semantics.

If the destination is on our current filesystem, then rename() is used.
Otherwise, src is copied to the destination and then removed.
A lot more could be done here...  A look at a mv.c shows a lot of
the issues this implementation glosses over.

        def move(src, dst):
    """Recursively move a file or directory to another location. This is
    similar to the Unix "mv" command.

    If the destination is a directory or a symlink to a directory, the source
    is moved inside the directory. The destination path must not already
    exist.

    If the destination already exists but is not a directory, it may be
    overwritten depending on os.rename() semantics.

    If the destination is on our current filesystem, then rename() is used.
    Otherwise, src is copied to the destination and then removed.
    A lot more could be done here...  A look at a mv.c shows a lot of
    the issues this implementation glosses over.

    """
    real_dst = dst
    if os.path.isdir(dst):
        real_dst = os.path.join(dst, _basename(src))
        if os.path.exists(real_dst):
            raise Error, "Destination path '%s' already exists" % real_dst
    try:
        os.rename(src, real_dst)
    except OSError:
        if os.path.isdir(src):
            if _destinsrc(src, dst):
                raise Error, "Cannot move a directory '%s' into itself '%s'." % (src, dst)
            copytree(src, real_dst, symlinks=True)
            rmtree(src)
        else:
            copy2(src, real_dst)
            os.unlink(src)
        


src/g/a/gajim-HEAD/setup_osx.py   gajim(Download)
from setuptools import setup
import sys, glob, os, commands, types
from os import system, unlink, symlink, getcwd, mkdir, utime
from shutil import move, copy, copytree, rmtree
 
###
### Globals
def setupPrep():
	copy("src/osx/prep_py2app.py", APP_RS)
	move("dist/Gajim.app/Contents/Resources/__boot__.py",
		 "dist/Gajim.app/Contents/Resources/__boot__.py.org")
	new = open("dist/Gajim.app/Contents/Resources/__boot__.py", "w+")
	org = open("dist/Gajim.app/Contents/Resources/__boot__.py.org")
	for line in org:
	symlink("Resources/data", "dist/Gajim.app/Contents/data")
	copy("src/gajim-remote.py", "dist/Gajim.app/Contents/Resources")
	# Nuke libs that are in the framework
	move("dist/Gajim.app/Contents/Frameworks/Python.framework",
		 "dist/Gajim.app/Contents/Python.framework")
	rmtree("dist/Gajim.app/Contents/Frameworks")
	mkdir("dist/Gajim.app/Contents/Frameworks")
	move("dist/Gajim.app/Contents/Python.framework",
		 "dist/Gajim.app/Contents/Frameworks/Python.framework")
	# Adjust the running of the app
	move("dist/Gajim.app/Contents/MacOS/Gajim",

src/o/r/organizasyonizm-HEAD/Kaynak/HddOkuYaz.py   organizasyonizm(Download)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
 
from os import listdir,path,removedirs,makedirs, rmdir, remove
import sys
from shutil import move, copytree, copy
import locale
    def tasi(_kaynak, _hedef):
        try:move(_kaynak.encode(Evrenseller.Ayarlarim["sistemKarakterSeti"]),_hedef.encode(Evrenseller.Ayarlarim["sistemKarakterSeti"]))
        except:move(_kaynak,_hedef)
 
    def diziniKopyala(_kaynak, _hedef):
        try:copytree(_kaynak.encode(Evrenseller.Ayarlarim["sistemKarakterSeti"]),_hedef.encode(Evrenseller.Ayarlarim["sistemKarakterSeti"]))
        except:copytree(_kaynak,_hedef)

src/h/a/hamsimanager-HEAD/trunk/ConfigureUpdate.py   hamsimanager(Download)
import sys,os
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from shutil import move, copytree, copy
import time
import tempfile, random
from os import listdir,path,removedirs,makedirs, rmdir, remove, rename
            else:
                if isFile(_newPath):
                    removeFileOrDir(_newPath)
                try:move(_oldPath.encode(fileSystemEncoding),_newPath.encode(fileSystemEncoding))
                except:move(_oldPath,_newPath)
 
    def copyFileOrDir(_oldPath, _newPath):

src/h/a/hamsimanager-HEAD/ConfigureUpdate.py   hamsimanager(Download)
import sys,os
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from shutil import move, copytree, copy
import time
import tempfile, random
from os import listdir,path,removedirs,makedirs, rmdir, remove, rename
            else:
                if isFile(_newPath):
                    removeFileOrDir(_newPath)
                try:move(_oldPath.encode(fileSystemEncoding),_newPath.encode(fileSystemEncoding))
                except:move(_oldPath,_newPath)
 
    def copyFileOrDir(_oldPath, _newPath):

src/i/t/itools-HEAD/fs/lfs.py   itools(Download)
from os.path import exists, getatime, getctime, getmtime ,getsize
from os.path import isfile, isdir, join, basename, dirname
from os.path import abspath, relpath
from shutil import rmtree, copytree, copy as shutil_copy, move as shutil_move
 
# Import from itools
from itools.uri import Path
    def move(self, source, target):
        source = self._resolve_path(source)
        target = self._resolve_path(target)
        # If target is a folder, move inside it
        return shutil_move(source, target)
 
 

src/m/o/morphix-HEAD/trunk/ibuild/src/intellibuild/clientlib/accessors/fs.py   morphix(Download)
  def mv(self, src, dst, fail=True):
      """
      Use this to move files and dirs across filesystem.
      Example: fs.mv("/usr/local/share/ibuild","/home/test/ibuild")
      If you want not to fail if unsuccessful, set fail to False
      """
      from shutil import move
      self.log.debug("Moving file " + src + " to " + dst)
      if not self.__simulate:
        move(src,dst)

src/m/o/morphix-HEAD/trunk/ibuild/src/intellibuild/clientlib/accessors/filesystem.py   morphix(Download)
  def Move(self, src, dst):
    from shutil import move
    if self.__verbose:
      print "Moving: %s to %s" % (src,dst)
    if not self.__simulate:
      move(src,dst) 
 

src/m/o/morphix-HEAD/ibuild/src/intellibuild/clientlib/accessors/fs.py   morphix(Download)
  def mv(self, src, dst, fail=True):
      """
      Use this to move files and dirs across filesystem.
      Example: fs.mv("/usr/local/share/ibuild","/home/test/ibuild")
      If you want not to fail if unsuccessful, set fail to False
      """
      from shutil import move
      self.log.debug("Moving file " + src + " to " + dst)
      if not self.__simulate:
        move(src,dst)

src/m/o/morphix-HEAD/ibuild/src/intellibuild/clientlib/accessors/filesystem.py   morphix(Download)
  def Move(self, src, dst):
    from shutil import move
    if self.__verbose:
      print "Moving: %s to %s" % (src,dst)
    if not self.__simulate:
      move(src,dst) 
 

src/p/y/pyquake3-HEAD/games/pyqcompile/__init__.py   pyquake3(Download)
    qcompile(cfg, game_dir)
 
    # move .pk3 from temp dir to original game dir
    from shutil import move, rmtree
    move(join(game_dir, 'build', '%s.pk3' % cfg.PROJECT_NAME), 
         join('_'.join(game_dir.split('_')[:-1]), 'build', '%s.pk3' % cfg.PROJECT_NAME))
 

  1 | 2 | 3 | 4 | 5 | 6  Next