The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Special Forums > Windows & DOS: Issues & Discussions
.
google unix.com



Windows & DOS: Issues & Discussions All Windows and DOS questions should go here as well. Discuss UNIX to Windows (Desktop or Server) here!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
pscp.exe trasforms a.sh to 'a.sh ' zzol Shell Programming and Scripting 2 01-01-2009 11:28 PM
Delete line in file based on data in another file earth_goddess Shell Programming and Scripting 1 12-29-2008 10:47 AM
how to delete record in file data with index in another file? zhynxn Shell Programming and Scripting 0 07-06-2006 12:03 AM
i want to delete a file based on existing file in a directory srivsn Shell Programming and Scripting 3 04-11-2006 04:38 AM
Get file from source server and delete the ftp file lweegp Shell Programming and Scripting 3 10-17-2005 02:53 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-10-2009
mohantmk mohantmk is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 9
Can we delete file using PSCP?

Hello,

I am using PSCP to do file transfer from remote server to window system. It works well.

But the file is only copying, but in my case once after file copied, we should not have the same file on the remote server it should be moved to the windows system or deleted on the remote server after copied.

So please give me a suggestion how to delete that file on remote server using PSCP.

--
Thanks,
Mohan
  #2 (permalink)  
Old 01-10-2009
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,715
PSCP does not support deleting a file. psftp does. See the pscp download page to download psftp.
  #3 (permalink)  
Old 01-12-2009
mohantmk mohantmk is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 9
Thanks, I will use PSFTP instead of PSCP.

I have few questions if i use PSFTP

I am using the below syntax to connect to server,
psftp.exe -l testlogin -pw testpassword -b script.bat host.name.net
all my file movement code in script.bat

script.bat contains:
cd SERVER/GETFILE
lcd C:\INBOUND
get Test one.txt
quit


1. How to get latest file from the server, example i am using test one.txt
2. How to get return codes from the script.bat
3. How to rename file name "Test one.txt" to "YYYYMMDDHHDDSS.txt" when GET
4. How to rename file name "YYYYMMDDHHMMSS.txt" to "Test one.txt" when PUT

Can you please clear my questions i can do all these using PSCP but, when i use code in the script.bat it doesn't recognizes keywords like "@ echo off" "IF" "SET etc.


If i have a way to delete file using PSCP, or any idea to delete that file from server from the same script program i dont have to change all the code again.

--
Thanks
Mohan
  #4 (permalink)  
Old 04-03-2009
eskiphill4 eskiphill4 is offline
Registered User
  
 

Join Date: Oct 2008
Location: Pacific Northwest
Posts: 12
The renaming of the files should be done by the batch file before / after the call to the psftp program. It does the transfer, it doesn't have to do everything else, that is why you have a batch file. The script.bat file is instructions for psftp. The place for the other instructions should be in the .bat file that calls psftp. To make things clearer, rename script.bat to script.spftp. This is not a .bat file so should not be labeled as a .bat file!
  #5 (permalink)  
Old 05-08-2009
dajones70 dajones70 is offline
Registered User
  
 

Join Date: May 2009
Posts: 1
Can we delete file using PSCP?

Use PSCP.EXE to get the file and PSFTP.EXE to delete after checking the return code.

PSCSP.EXE [options]
IF “%ERRORLEVEL%” == “1” GOTO ERROR
PSFTP.EXE [options] -b del.batch
GOTO END
:ERROR
ECHO "There was an error getting the file."
REM Use blat.exe to send emails. SourceForge.net: Blat - A Win32 Command Line SMTP Mailer
:END
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:18 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0