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


Closed    
 
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: 22 July 2017, 7:00 AM EDT
Location: Aachen, Germany
Posts: 11,057
Thanks: 284
Thanked 3,408 Times in 3,138 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
Closed

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 08:13 PM
How to copy a file from one location to another location? vel4ever Shell Programming and Scripting 1 01-12-2012 04: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 03:47 AM
Help on Moving files from one location to another location kpagadala Shell Programming and Scripting 4 04-09-2010 02:45 AM
Put one string from one location to another location in a file jimmy_y Shell Programming and Scripting 1 11-24-2009 12:08 PM



All times are GMT -4. The time now is 02:53 AM.