Sponsored Content
Top Forums Programming Moving a file from one location to another. Post 302984042 by arjun_arippa on Thursday 20th of October 2016 06:18:08 AM
Old 10-20-2016
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
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

copy files from one location to similar location

I need help in forming a script to copy files from one location which has a sub directory structure to another location with similar sub directory structure, say location 1, /home/rick/tmp_files/1-12/00-25/ here 1-12 are the number of sub directories under tmp_files and 00-25 are sub... (1 Reply)
Discussion started by: pharos467
1 Replies

2. Shell Programming and Scripting

Bash copy file contents into an existing file at a specific location

Hi all I need to copy the entire contents of one file into an existing file at a specific location. I know the exact line number where I need to put it. It appears I would use either sed or awk to do this, but I have been unsuccessful so far: File A line 1 line 2 line 3 line 4 ... (6 Replies)
Discussion started by: gshepherd7
6 Replies

3. Shell Programming and Scripting

Put one string from one location to another location in a file

Hi Everyone, I have 1.txt here a b c' funny"yes"; d e The finally output is: here a b c d e' funny"yes"; (1 Reply)
Discussion started by: jimmy_y
1 Replies

4. Shell Programming and Scripting

Shell Script for Copy files from one location to another location

Create a script that copies files from one specified directory to another specified directory, in the order they were created in the original directory between specified times. Copy the files at a specified interval. (2 Replies)
Discussion started by: allways4u21
2 Replies

5. Shell Programming and Scripting

Help on Moving files from one location to another location

Hi, I am new to unix and shell scripting. Please help me in resolving the below issue. In my shell script I have a variable which stores the different files with the path. Now I need to move all the files one by one to another location. ---- 1.... (4 Replies)
Discussion started by: kpagadala
4 Replies

6. Shell Programming and Scripting

File created in a different location instead of desired location on using crontab

Hi, I am logging to a linux server through a user "user1" in /home directory. There is a script in a directory in 'root' for which all permissions are available including the directory. This script when executed creates a file in the directory. When the script is added to crontab, on... (1 Reply)
Discussion started by: archana.n
1 Replies

7. Shell Programming and Scripting

How to copy a file from one location to another location?

I have file file1.txt in location 'loc1'. Now i want a copy of this file in location 'loc2' with a new file called test.txt. Please help me how to do this in shell script. (1 Reply)
Discussion started by: vel4ever
1 Replies

8. Shell Programming and Scripting

How to find a existing file location and directory location in Solaris box?

Hi This is my third past and very impressed with previous post replies Hoping the same for below query How to find a existing file location and directory location in solaris box (1 Reply)
Discussion started by: buzzme
1 Replies

9. Shell Programming and Scripting

Help with copying the list of files from one location to other location

A) I would like to achive following actions using shell script. can someone help me with writing the shell script 1) Go to some dir ( say /xyz/logs ) and then perform find operation in this dir and list of subdir using find . -name "*" -print | xargs grep -li 1367A49001CP0162 >... (1 Reply)
Discussion started by: GG2
1 Replies

10. Shell Programming and Scripting

Curl to download file from subdivx.com after following location without knowing the file name/extens

This question could be specific to the site subdivx.com In the past, I've been able to download a file following location using cURL but there is something about subdivx.com that's different and can't figure out how to get it to work. I tried the following directly in the terminal with no... (5 Replies)
Discussion started by: MoonD
5 Replies
sttmpfiles(3)						    ShapeTools Toolkit Library						     sttmpfiles(3)

NAME
stTmpFile, stRegisterFile, stUnRegisterFile, stRmRegisteredFiles - temporary files handling SYNOPSIS
#include <config.h> #include <sttk.h> char*stTmpFile (char *path); voidstRegisterFile (char *fileName); voidstUnRegisterFile (char *fileName); voidstRmRegisteredFiles (void); DESCRIPTION
stTmpFile creates a unique filename for a temporary file, registers it (see stRegisterFile below), and returns it. The return value resides in static memory and will be overwritten on the next call of stTmpFile. The temporary file is located in the /tmp directory. stRegisterFile adds the given fileName to an internal static list of file names. This list helps to keep track of the names of all tempo- rary files to be deleted until the end of the program execution. On abnormal program termination (signal), the termination handler may call stRmRegisteredFiles to delete all registered files. This avoids bogus temporary files to survive abnormal program termination. stUnRegisterFile removes fileName from the internal list of file names. It should be called when the corresponding file was removed due to the regular control flow. stRmRegisteredFiles removes all files named in the internal list set up by stTmpFile and stRegisterFile and clears the list. Bogus entries in the list (names without a correponding file) are ignored. Invoking stCatchSigs(3) causes stRmRegisteredFiles to be called on occurence of the signals SIGQUIT, SIGFPE, SIGBUS, SIGSEGV, and SIGTERM. stCleanup(3) also calls stRmRegisteredFiles. SEE ALSO
stCatchSigs(3), stCleanup(3) LIMITS
The maximum number of temporary files to be registered is 16. sttk-1.7 Thu Jun 24 17:43:36 1993 sttmpfiles(3)
All times are GMT -4. The time now is 05:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy