Re: How can I use system cmd with variables?
- Posted by Shawn <pringle at t?c?ie.com> Sep 21, 2007
- 510 views
I am not aware of any such function in any programming language. All of them provide generic functions that do one or another. The distinction is just not made in the kernel of the OSes as the actions as moving is just a generalization of renaming. In UNIX there is no rename command. People are accustomed to using 'mv' for doing either operation. Ok. I think if you do move_file( "dir1\\file1", "file2" ) it will probably also move the file to dir1, which is not what you want. With system however, the user could inject code strings. Like with SQL injection attacks. If you are curious about other renaming programs there is one available for Linux and it is distributed on the Puppy Linux CD. That version of Linux runs out of memory that is loaded from the CD. So you don't have to mess with your computer's hard drive. Shawn Pringle Dan Moyer wrote: > > Shawn, > > Ok, thanks, I didn't know about those routines. I haven't looked at them > yet, but the example you provided suggests it will *move* and rename a file, > is there one that just renames it? > > I'm just curious, as the system() command as elaborated by Derek worked fine > for what I wanted. > > Dan > > Shawn wrote: > > > > > > I think you asked the wrong question. system() puts a > > black rectangle on the screen. I would ask how do you > > rename files without going through system()? Unless you > > are coding for DOS you > > can use the ssl.e routines from the archive like this: > > > > include ssl.e as ssl > > > > if ssl:move_file( ssl:join( "\\", {folderPathName,oldFileNames[n]} ), > > ssl:join( "\\", {folderPathName,newFileNames[n]} ) ) then > > -- success > > end if > > > > Shawn Pringle