Unix/Linux Go Back    


Programming Post questions about C, C++, Java, SQL, and other programming languages here.

Moving a file from one location to another.

Programming


Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 10-20-2016
arjun_arippa arjun_arippa is offline
Registered User
 
Join Date: Dec 2011
Last Activity: 25 October 2016, 1:02 AM EDT
Posts: 25
Thanks: 4
Thanked 0 Times in 0 Posts
Moving a file from one location to another.

Hi,

I've done a set of operations on some text files using a someexecutuble.jar file, which is internally calling some python scripts. Post that, in same location, my jar created some log files.

However, i'm not able to re-direct the log files to some other location in my windows directory. I tried the below code


Code:
def printValReport(fileName, errorList, warningList):
        logPath = 'C:\Users\arjun_arippa\Desktop\log\'
	if errorList:
		fp = open(fileName + "_reviewErrors.log","a+")
		for err in errorList:
			print >> fp ,  err
                os.rename(fileName + "_reviewErrors.log", logPath)

However the same is not working. I tried with:

Code:
shutil.move(fileName + "_reviewErrors.log", logPath + fileName + "_reviewErrors.log")

Still not working.. can someone please help me how to do the same in python code itself rather than making any changes in the java code calling my python scirpts.

Thanks,
Arjun
Sponsored Links
    #2  
Old Unix and Linux 10-20-2016
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 23 January 2017, 4:06 PM EST
Location: Aachen, Germany
Posts: 10,164
Thanks: 230
Thanked 3,075 Times in 2,851 Posts
WHAT is "not working"? Please post error messages and unwanted as well as desired results.
Can't you just redefine the logPath variable to opoint to somewhere else?
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to find a existing file location and directory location in Solaris box? buzzme Shell Programming and Scripting 1 01-10-2013 09:13 PM
How to copy a file from one location to another location? vel4ever Shell Programming and Scripting 1 01-12-2012 05:29 AM
File created in a different location instead of desired location on using crontab archana.n Shell Programming and Scripting 1 10-20-2011 04:47 AM
Help on Moving files from one location to another location kpagadala Shell Programming and Scripting 4 04-09-2010 03:45 AM
Put one string from one location to another location in a file jimmy_y Shell Programming and Scripting 1 11-24-2009 01:08 PM



All times are GMT -4. The time now is 11:00 PM.