
Thank you again!
To be sure: does that actually work on your system? Only then we should proceed.FatalOne wrote:Yes, that makes perfect sense. Question though... why "print" the various info, doesn't that just display it on the console screen? Just trying to understand whats going on is all...
Thank you again!
/home/sander/Downloads/SABdownloads/bigrandomfile (1).1
bigrandomfile (1)
/home/sander/MyDownloads/bigrandomfile (1)
Code: Select all
import sys, shutil
sourcedirectory = sys.argv[1] ### The final directory of the job (full path)
jobname = sys.argv[3]
print sourcedirectory
print jobname
destinationdirectory = 'E:\ServerFolders\Videos\Movies\' + jobname
print destinationdirectory
shutil.move(sourcedirectory, destinationdirectory)
exit(0)
Code: Select all
import sys, shutil, os
sourcedirectory = sys.argv[1] ### The final directory of the job (full path)
splitchar = os.sep
print sourcedirectory
print "\n",sourcedirectory
last = sourcedirectory.split(splitchar)[-1]
if last == '':
last = sourcedirectory.split(splitchar)[-2]
print last
lastfolder = last
last = last.upper()
print last
last = last.replace("THE ","")
print last
firstchar = last[0]
print firstchar
if firstchar >= 'A' and firstchar <= 'Z' :
print "Yes"
else:
firstchar = '#'
destinationdirectory = 'E:\\ServerFolders\\Videos\\Movies\\' + firstchar + '\\' + lastfolder
print destinationdirectory
shutil.move(sourcedirectory, destinationdirectory)
exit(0)
Code: Select all
splitchar = '\\'
Code: Select all
splitchar = os.sep
Code: Select all
sander@hapee:~$ python
Python 2.7.5+ (default, Jun 5 2013, 10:40:07)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> print os.sep
/
>>>
sander@hapee:~$