f

#### How Do I Copy Over An Existing File in an Obey File?

How embarassing is this.

I have two files a and a/zip. When I'm happy with a/zip I'd like to
rename it "a" (and do a few other things too, but we'll just stick to
the copy / rename / delete problem for now).

In Unix, I'd just type "mv a.zip a" and that would generally be that.

But writing an Obey file to do it makes my head hurt.

If I write "copy a/zip a DFQ~N~P" it does what I want, but prompts me if
I want to move the file.

So, I thought I'd try deleting, or wiping the file "a" first - but if
the file "a" doesn't exist, the script errors and exits.

So how do I end up with "a" being replaced by "a/zip" without being
prompted (apart from using the UPP's port of "mv")?

James

 0
James
3/28/2006 5:32:03 PM
comp.sys.acorn.programmer 2499 articles. 0 followers.

6 Replies
520 Views

Similar Articles

[PageSpeed] 49

In article <8HeWf.37$Nb2.66@news.oracle.com>, James Sargent <root@127.0.0.1> wrote: > How embarassing is this. > > I have two files a and a/zip. When I'm happy with a/zip I'd like to > rename it "a" (and do a few other things too, but we'll just stick to > the copy / rename / delete problem for now). > > In Unix, I'd just type "mv a.zip a" and that would generally be that. > > But writing an Obey file to do it makes my head hurt. > > If I write "copy a/zip a DFQ~N~P" it does what I want, but prompts me if > I want to move the file. Try "A~CDF~L~N~P~QR~S~T~V". That should do it! I think your main problem was not having ~C (confirm). See "*Help Copy" for some info. If you get a complaint that "File xxx is a directory" you will need to settype the archive to (say) data first because something (e.g. SparkFS) is treating the archive as an image file (which then looks like a directory to *Copy). Steve -- Steve Revill @ Home Note: All opinions expressed herein are my own.   0 steve.DELETE (270) 3/28/2006 6:13:03 PM On 28 Mar 2006 as I do recall, James Sargent wrote: > How embarassing is this. > > I have two files a and a/zip. When I'm happy with a/zip I'd like to > rename it "a" (and do a few other things too, but we'll just stick to > the copy / rename / delete problem for now). > > In Unix, I'd just type "mv a.zip a" and that would generally be that. > > But writing an Obey file to do it makes my head hurt. > > If I write "copy a/zip a DFQ~N~P" it does what I want, but prompts me if > I want to move the file. > > So, I thought I'd try deleting, or wiping the file "a" first - but if > the file "a" doesn't exist, the script errors and exits. > Use *Remove instead of *Delete. -- Harriet Bazley == Loyaulte me lie == The best laid schemes o' mice and men gang oft a-gley.   0 bazley (1305) 3/28/2006 6:20:10 PM James Sargent wrote: > How embarassing is this. > > I have two files a and a/zip. When I'm happy with a/zip I'd like to > rename it "a" (and do a few other things too, but we'll just stick to > the copy / rename / delete problem for now). > > In Unix, I'd just type "mv a.zip a" and that would generally be that. > > But writing an Obey file to do it makes my head hurt. > > If I write "copy a/zip a DFQ~N~P" it does what I want, but prompts me if > I want to move the file. > > So, I thought I'd try deleting, or wiping the file "a" first - but if > the file "a" doesn't exist, the script errors and exits. > > So how do I end up with "a" being replaced by "a/zip" without being > prompted (apart from using the UPP's port of "mv")? *Remove a *Rename a/zip a John.   0 this (338) 3/28/2006 6:26:21 PM James Sargent wrote: > I have two files a and a/zip. When I'm happy with a/zip I'd like to > rename it "a" (and do a few other things too, but we'll just stick to > the copy / rename / delete problem for now). > > In Unix, I'd just type "mv a.zip a" and that would generally be that. > > But writing an Obey file to do it makes my head hurt. > > If I write "copy a/zip a DFQ~N~P" it does what I want, but prompts me if > I want to move the file. > > So, I thought I'd try deleting, or wiping the file "a" first - but if > the file "a" doesn't exist, the script errors and exits. > > So how do I end up with "a" being replaced by "a/zip" without being > prompted (apart from using the UPP's port of "mv")? Thanks to Ste / John / Harriet for answering this noddy question. The copy with a ~C worked nicely, the remove / rename option is faster! However, I'll stick with the copy ~C so that I don't end up with 0 files in case a/zip is missing. I'll think I'll try to keep away from the command line in the future, it appears far too scary! James   0 James 3/28/2006 7:05:11 PM In article <s2gWf.39$Nb2.64@news.oracle.com>,
James Sargent <root@127.0.0.1> wrote:

> The copy with a ~C worked nicely, the remove / rename option is faster!
>    However, I'll stick with the copy ~C so that I don't end up with 0
> files in case a/zip is missing.

That'll also work across filing systems, unlike 'rename'.

John

--
John Williams, Wirral, Merseyside, UK - no attachments to these addresses!
Non-RISC OS posters change user to johnrwilliams or put 'risc' in subject
for reliable contact! Who is John Williams? http://www.picindex.info/author/

 0
UCEbin (2771)
3/28/2006 7:16:55 PM
James Sargent wrote:
> The copy with a ~C worked nicely, the remove / rename option is faster!
>   However, I'll stick with the copy ~C so that I don't end up with 0
> files in case a/zip is missing.

That can be addressed with "IfThere <file> Then <command> Else <command>".

John.

 0
this (338)
3/28/2006 7:20:31 PM

Similar Artilces:

copy data from .xlsx/.xls file as new records to an EXISTING .dbf file (via programming in a clipper 5.3 .PRG file)
.xlsx/.xls data be saved as new records in an existing .dbf file (to be done by programming in a clipper 5.3 .prg file) i have this in an .xlsx/.xls file: Name Hours Date Assign OPE Comments XXT 4.50 20/12/2014 AUDIT Conveyance checked 1314 books P01 12.05 23/12/2014 DUED1 Lunch computed net worth XXT .10 23/12/2014 M&A merged stock... 90H 2.00 02/01/2015 AUDIT Xerox found discrepancies can the 4 (or more records) be read & saved as 4 ...

File, Find References, Copy Files: Truncating Long File Names
Hello All- I just experienced this behavior this morning. It was repeatable. Has anyone else seen this? The file Name was cut off after 57 characters. XP Pro SP2 2006 SP0 Office XP 2003 Pro Best Regards, Devon T. Sowell www.3-ddesignsolutions.com How long was the path name in total? Total including the file extension (.SLDASM) = 174. The file Extension was retained, just the Name was chopped off. These are my customer's files. Best Regards, Devon T. Sowell www.3-ddesignsolutions.com "TOP" <kellnerp@cbd.net> wrote in message news:1128364278.638472.150320@f14g2000...

File IO/Copy A File
I am stumped on this one... Any easy way to copy a file from a button event in RB 5.2? I basically want the button to copy DB.rdb to DB.bak. THis way is someone hozes the file, we have a backup. Thanks in advance, SJ > I am stumped on this one... > > Any easy way to copy a file from a button event in RB 5.2? I > basically want the button to copy DB.rdb to DB.bak. THis way is > someone hozes the file, we have a backup. > > Thanks in advance, > > SJ Maybe I am missing what you are trying to do - but wouldn't FolderItem.CopyFileTo d...

Append a file to an existing file
Hi there I am wondering if there is a simple command in Tcl that I can append a file to an existing file, or combine two files into one file ? Thanks for the help. Regards S-Y. Chen S-Y. Chen wrote: > Hi there > > I am wondering if there is a simple command in Tcl that I can append a > file to an existing file, or combine two files into one file ? > > > Thanks for the help. > > Regards > S-Y. Chen > Here's one way... - [open] fileA in append mode - [open] fileB in read only mode - [read] the contents of fileB and write it to fileA using [puts] - [close] both files So, the man pages on [open], [read], [puts], and [close] should give you all you need. Jeff On Aug 4, 12:45=A0am, Jeff Godfrey <jeff_godf...@pobox.com> wrote: > S-Y. Chen wrote: > > Hi there > > > I am wondering if there is a simple command in Tcl that I can append a > > file to an existing file, or combine two files into one file ? > > > Thanks for the help. > > > Regards > > S-Y. Chen > > Here's one way... > > - [open] fileA in append mode > - [open] fileB in read only mode > - [read] the contents of fileB and write it to fileA using [puts] > - [close] both files > > So, the man pages on [open], [read], [puts], and [close] should give you > all you need. > > Jeff I know I can do it through open, read and close.....just want to see if there is a command like copy a+b...

Copying a file to another file
Hi, I wrote the following C program to copy a file to another file. #include <stdio.h> #include <stdlib.h> static FILE *open_file ( char *file, char *mode ) { FILE *fp = fopen ( file, mode ); if ( fp == NULL ) { perror ( "Unable to open file" ); exit ( EXIT_FAILURE ); } return fp; } int main ( int argc, char *argv[] ) { /* int ch;*/ FILE *from; FILE *to; char *buffer; long lSize; if ( argc != 3 ) { fprintf ( stderr, "Usage: %s <readfile1> <writefile2>\n", argv[0] ); exit (1);/* E...

While playing with some code for another thread, I discovered that among the BASIC language diagnostics was the text FILE NOT FOUND. I am unable to find FILE EXISTS among the BASIC diagnostics. When I attempt a load of a non existent file, the drive error light blinks and the system issues a FILE NOT FOUND diagnostic. When I try to save data with a name of a file already on the disk, the drive error light blinks but no diagnostic is issued by the system. In both cases, the drive needs to be queried to retrieve the drive's diagnostic and to stop the drive error light from blinking. I ha...

copy txt file - only copies 1/3 of the file
File.open('oldFile.txt', 'r') do |f1| #file contains XML type data m = f1.gets File.open('newFile.txt','w') do |f2| #newFile to separate data in oldFile f2.puts m.split("<") end end Hello All. There is something that I did that was weird here. I say this because when I open the new file that it creates its 1/3 the size of the original. It seems to just completely cut off. I took off the .split and it still did this, so I know it has nothing to do with split. What do you think is going on? oldFile.txt contains XML formatted data. ...

file extention from file file location
Hi, I am new to perl (only working on this one problem) but I program in other languages. We have an upload script written in cgi. Can anyone tell me how to get the file extension from the variable $File1 (actual file location on uploader's computer) then find out if it is equal to "txt" Thanks in advance for not telling me to read the manual. Ron -- PLEASE NOTE: comp.infosystems.www.authoring.cgi is a SELF-MODERATED newsgroup. aa.net and boutell.com are NOT the originators of the articles and are NOT responsible for their content. HOW TO POST to co... GUI *.fig file deleted, *.m file still exists, can *.fig file be retrieved? I created a GUI, but the *.fig file was deleted, the *.m or code file still exists, can *.fig file be retrieved or can I regenerate the *.fig file from the *.m file? I am using MATLAB 6.5 Release 13. Please Help! Brian Bird wrote: > > > I created a GUI, but the *.fig file was deleted, the *.m or code > file > still exists, can *.fig file be retrieved or can I regenerate the > *.fig file from the *.m file? I am using MATLAB 6.5 Release 13. > Please Help! No, however the file might still be on the hard disk. Google for "undelete". One of the first hits is <h... Iteration through File.file? misses entries for which File.file?(entry) == true Hello everyone, I'm new to Ruby, so I'm most likely making an elementary mistake. However, searching Google didn't help me find my answer, and after mucking around with irb I still haven't figured it out. I wrote a method that was intended to take all of the files in a given directory and put them into an array. Here's the code I wrote: def getFiles(dir) pwdFiles = Array.new Dir.foreach(dir) do |entry| pwdFiles.push(entry) if File.file?(entry) == true end end This works fine when called on the working directory --- that is, getFile... opening file Hello, This really drives me nuts. Im opening an input file, and Im testing if it was open successfully. Thats it! I know that the file that Im trying to open DOES NOT exist but Im getting NO error message. No matter what name I enter I get 'file opened successfully" Any clues? Thanks! #include <iostream.h> #include <stdlib.h> #include <stdio.h> #include <fstream.h> int main() { ifstream infile; char file_name[16]; printf("\nEnter file name: "); cin>>file_name; infile.open(file_name); if (infile.fail()) ... copy all files except dot files Will the following sequence cd /dest-dir cp /source-dir/* . copy EVERYTHING ? But i don't want those dot files like .profile .sh_history to be copied across. What command to use instead? On 7 Mar 2004 06:28:06 GMT, pui ming Wong <s11976@net2.hkbu.edu.hk> wrote: > Will the following sequence > cd /dest-dir > cp /source-dir/* . > > copy EVERYTHING ? > > But i don't want those dot files like .profile .sh_history > to be copied across. > What command to use instead? > cp /source-dir/* . will not copy dot files. -- Incrsease your earoning pos... Cannot create a file when that file already exists I built a dummy Win32 Smart Device application from the Visual Studio 2005 wizard and upon deploying the application to the real Pocket PC device connected with ActiveSync 4.0, I got the following error message in the output console: "Cannot create a file when that file already exists". I had this error even the first time I deployed the application; thus it is not a problem because of a file I am trying to deploy that already exists. I did the same test on the Pocket PC 2003 emulator and everything works fine. Do you know to which file the error message is referring to? ... Add a filed to existing dbf file Dear Sir, Is there any way to Add a field in existing dbf file with xharbour (Programmatically) ? Regards Bapu. "Bapu" <learning_b@yahoo.com> ha scritto nel messaggio news:46a730be$0$1348$834e42db@reader.greatnowhere.com... > Dear Sir, > > Is there any way to Add a field in existing dbf file with xharbour > (Programmatically) ? No, you have to create a new empty DBF using the changed structure and copy records from the old. Then delete the old and rename the new. EMG -- EMAG Software Homepage: http://www.emagsoftware.it The EMG's ZX-Spectrum Page: http://www.emagsoftware.it/spectrum The Best of Spectrum Games: http://www.emagsoftware.it/tbosg The EMG Music page: http://www.emagsoftware.it/emgmusic Dear Bapu: "Bapu" <learning_b@yahoo.com> wrote in message news:46a730be$0$1348$834e42db@reader.greatnowhere.com... > Dear Sir, > > Is there any way to Add a field in existing dbf file > with xharbour (Programmatically) ? Here is about what FauxPro does when you "just add a field"... use ("TooSmall") copy structure extended to ("ItsStructure") use ("ItsStructure") append blank replace FIELD_NAME with _, FIELD_TYPE with _, FIELD_LEN with _, FIELD_DEC with _ use commit create ("BigEnough") from ("ItsStructure") append from ("TooSmall") .... you can recreate the orderbags here if you need to use commit ferase("ItsStructure... Copying Files and retaining File Permission Hi, I need to transfer files from ServerA to ServerB. ServerA is the domain controller, and ServerB is the Additional domain controller in the same domain. What is the easiest way to do this? There are folders with ACL granted to domain users. Server A - Windows 2000 Server Server B - Windows 2003 Server Domain - linx.local If I use traditional way to transfer files, it will lose all the permission, and stop halfway if the file is in use. Any software to skip file in use during copy and report the files in log files? I have heard of RoboCopy. Is it useful in this situation, and any guides ... Copying File or Changing File Date Hi, How do you change the file creation date of a file in windows using java. I tried the File.setLastModified() method and it is not doing what I hoped it would do which is to change the date time stamp displayed in windows explorer. I basically want to copy a file read via InputStream from a URL and written into a local file system using DataOutputStream. The problem is the file written using DataOutputStream is created ad hoc and creates a "new" file with the current datetime stamp. Is it possible to "copy" a file from a URL source or a server-side file system source ... Get path from FILE* of existing file Hi all! I've got a FILE* pointing to an already opened file. I want to create a new file in the same directory where that file is. Is there any way of obtaining file path from FILE*? Many thanks/Alvaro "Alvaro Puente" <alvaro.puente-gonzalez@ece.ericsson.se> wrote in message news:bec2qn$8td$1@newstree.wise.edt.ericsson.se... > Hi all! > > I've got a FILE* pointing to an already opened file. > I want to create a new file in the same directory where > that file is. > > Is there any way of obtaining file path from FILE*? From the C FAQ: 19.15: ... Copying Files and retaining File Permission Hi, I need to transfer files from ServerA to ServerB. ServerA is the domain controller, and ServerB is the Additional domain controller in the same domain. What is the easiest way to do this? There are folders with ACL granted to domain users. Server A - Windows 2000 Server Server B - Windows 2003 Server Domain - linx.local If I use traditional way to transfer files, it will lose all the permission, and stop halfway if the file is in use. Any software to skip file in use during copy and report the files in log files? I have heard of RoboCopy. Is it useful in this situation, and any guides ... Writing a log file from an obey file In message <51a5dbfe09news*@Torrens.org.uk> "Richard Torrens (News)" <News+15019@Torrens.org.uk> wrote: > Lua looks attractive, but it's a long learning curve for a single job! Here is the single job then: Write the following in a text file called "writelog": do local var,logfile,err = os.getenv,arg[1],"Cannot open " local log = assert(io.open(logfile,"a+"),err..logfile) log:write("\n", var "Sys$Time"," on ",var "Sys$Date","\n", var "cycle_No","\n", var "file$","\n") log:close() end Put it in the same directory as an Obey file containing lua <Obey$Dir>.writelog <pathname_of_logfile> Running the obeyfile will update your log file. For learning Lua, Roberto Ierusalimschy's book "Programming in Lua" (2-nd edition, ISBN 85-903798-2-5) is the authoritative text. It is a good read for anybody interested in programming, whether in Lua or not. It is the first edition which is online. For those who have already begun, the "Lua 5.1 Reference Manual" (ISBN 85-903798-3-3) is a useful adjunct (and very slim). -- Gavin Wraith (gavin@wra1th.plus.com) Home page: http://www.wra1th.plus.com/ In message <8f26fda551.wra1th@wra1th.plus.com> Gavin Wraith <gavin@wra1th.plus.com> wrote: > > For learning Lua, Roberto Ierusalimschy'... Copy Files with long file names Hi, I am using CopyFile (Scripting.FileSystemObject) to copy file from one location to another. The naming convention followed makes the file names (+ the path) lenghty and the total characters can exceed 260 characters. I would appreciate if you can let me know if there is any solution to bypass max limit (Filename + Path) of 260 characters. The copying of file from one location to another happens on the click of a button in MS Access Forms. Thanks in Advance. Regards Bala Access Version : Access 2003 The files (can be any type of files like .xls, .doc, .pdf etc..) i... Testing file size and file exist? I want to perform a couple of statements if either the file does not exist OR the file size of a given file is equal 0. Currently the best solution I can imagine is something like: if [! -e myfile.dat ]; then echo "File not existing or file size = 0" do_something else filesize=wc -c myfile.dat echo "filesize=$filesize" if [ $filesize = 0 ]; then echo "File not existing or file size = 0" do_something fi fi The first problem I encounter is that the back ticks are NOT recognized by the shell interpreter. filesize contains blank af... create a zip file with existing files in it I try the zip example described in the doc. It worked that way. But now I want to add existing files to a new created zip. first the code <code> void OBApp::Test () { wxFFileOutputStream out(_T("C:\\test.zip")); wxZipOutputStream zip(out); wxTextOutputStream txt(zip); // ?? wxFileInputStream strFile("C:\\autoexec.bat"); wxString sep(wxFileName::GetPathSeparator()); zip.PutNextEntry(_T("C:\\autoexec.bat")); txt << _T("Some text for entry1.txt\n"); zip.PutNextEn... How to open a file for binary access without creating an empty file if the file doesn't exist I'd like to open a file for binary access Open "C:\Test\myfile.bin" For Binary Lock Read Write As #1 Unfortunately if the file does not exist an empty file is created (Visual Basic Documentation: If the file specified by pathname doesn't exist, it is created when a file is opened for Append, Binary, Output, or Random modes). Today before opening the file for binary access I check if the file exists. But I experienced situations where the file during the file check existed and just before the opening of the file it has been removed by another programm. Is there really no possibility to open a file for binary access only if the file exists and else to get an error message which I can handle with On Error? Hmm. That's an interesting question. Lookup the OpenFile API in MSDN. I think it does exactly what you want. Also, perhaps after (inadvertantly) creating the file using VB's Open statement you can test for LOF(). If it's zero you probably created the file, no? Additional I doubt that anything could happen to the file between Psuedocode: If MyFileExists Then OpenMyFile The operation most likely takes places in the same clock cycle. Though, I guess, VB's Dir$ (for some reason) is pretty slow and might not. Try FindFirstFile API instead... it's super-fast. "Stefan Mueller" <noemail@noemail.com> wrote in message news:cahk91$sd$1@news.eusc.inter.net... > I'd like to open a file for binary access > Open &qu...

write file + input file + write file

Web resources about - How Do I Copy Over An Existing File in an Obey File? - comp.sys.acorn.programmer

Pre-existing condition - Wikipedia, the free encyclopedia
J. James Rohack, president of the American Medical Association , has stated on a Fox News Sunday interview that exclusions, based upon these ...

STUDY: Facebook More Effective In Driving Viewers To New Shows Than Existing Ones
... television and Facebook and other social networks, finding that social media are more effective at driving viewership of new shows than existing ...

A New Way To Re-Engage Your Existing Mobile App Users
Today we are introducing a new way to re-engage your mobile app users with Facebook ads. You can now advertise to people who have taken specific ...

... according to an eighth amendment to its S-1 filing with the Securities and Exchange Commission. Most of these shares are being sold by existing ...

How do you grow your brand through existing clients?
Anna Farmery and I are doing a podcast this week on how to leverage happy clients to grow your brand. We&#39;d love to include your advice in ...

Video Zoom - Apply Zoom To Existing Videos, Crop on the App Store on iTunes
Get Video Zoom - Apply Zoom To Existing Videos, Crop on the App Store. See screenshots and ratings, and read customer reviews.

“The important thing is not to stop questioning. Curiosity has its own reason for existing.” Albert Einstein ...
Pretty dreary here today, but this stop sign caught my attention. Bright, vivid colors can draw attention and add "pop" to a photo. Make a photo ...

Shorten unveils Labor election policy: No more negative gearing existing homes
... policy that Opposition Leader Bill Shorten says will save the federal budget \$32 billion over a decade. But, from July 2017, buyers of existing ...

US existing home sales fall in August
... as investors retreated from real estate and first-time buyers remained scarce. The National Association of Realtors says sales of existing ...

Leaked cabinet advice shows existing road funding to be relaunched as new
... under question, after a leaked cabinet submission showed Roads Minister Luke Donnellan&#10003;&#8203; is preparing to simply repackage an existing ...

Resources last updated: 3/25/2016 11:03:03 AM