www.ClassicTW.com
https://mail.black-squirrel.com/

write file to new directory
https://mail.black-squirrel.com/viewtopic.php?f=15&t=20249
Page 1 of 2

Author:  Zarkahn [ Thu Jan 17, 2008 3:46 pm ]
Post subject:  write file to new directory

working on my sys op script some more... trying to make the output better looking,
But do to all the files already wrote into the twx directory,
Is there a way to write it to a new folder inside the TWX directory?

Author:  Singularity [ Thu Jan 17, 2008 5:02 pm ]
Post subject:  Re: write file to new directory

Specify a path... write to "c:\blah\whatever.txt" and that's where it'll go.

Author:  Zarkahn [ Thu Jan 17, 2008 5:50 pm ]
Post subject:  Re: write file to new directory

well was trying to do a new path within the twx directory.. which varies player to player...
makes it a easier to find...

Author:  Parrothead [ Thu Jan 17, 2008 7:06 pm ]
Post subject:  Re: write file to new directory

Zarkahn wrote:
well was trying to do a new path within the twx directory.. which varies player to player...
makes it a easier to find...


write to ...\data\newdata\newdata.txt as a relative dir but folder must be there already.

Author:  Singularity [ Thu Jan 17, 2008 7:39 pm ]
Post subject:  Re: write file to new directory

3 dots? lol...

.\whatever\file.txt

. is current directory, .. is previous directory. It's all just DOS stuff.

Author:  Promethius [ Thu Jan 17, 2008 8:25 pm ]
Post subject:  Re: write file to new directory

In the gamestats script that I wrote I have the sysOp include the following in config.txt:

server name
path (where path can be wherever they want the file to end up. )

I should prob rename config.txt to GameStatsConfig.txt so I don't get clashes with someone's config.txt file.

Author:  Mind Dagger [ Thu Jan 17, 2008 8:28 pm ]
Post subject:  Re: write file to new directory

Being able to create a new directory would be very nice. Could have a bunch of different uses, like creating auto-installation for scripts or script packs maybe..

Who knows.

MD

Author:  Parrothead [ Fri Jan 18, 2008 1:31 am ]
Post subject:  Re: write file to new directory

Singularity wrote:
3 dots? lol...

.\whatever\file.txt

. is current directory, .. is previous directory. It's all just DOS stuff.



actually it wont work that way.....syntax varies.....if anyone needs it hit me up on icq.

Author:  Singularity [ Fri Jan 18, 2008 1:39 am ]
Post subject:  Re: write file to new directory

Hmm, really now... ok.

Here's code I just tested:
Code:
setVar $this_dir_file ".\this_dir.txt"
setVar $prev_dir_file "..\prev_dir.txt"
delete $this_dir_file
delete $prev_dir_file

write $this_dir_file "This dir"
write $prev_dir_file "Prev dir"


this_dir.txt was written to twxproxy's dir, and prev_dir.txt was written to my "tradewars" directory directly above it.

Seems to work just fine here. Naturally if the script directory has been changed you'd need to find the new one, or if there are other absolute directories you'd need to work on them specifically. But for simple relative paths this seems to work fine.

Author:  Zarkahn [ Fri Jan 18, 2008 8:34 am ]
Post subject:  Re: write file to new directory

thaks guys
the ./worked fine
the directory having to exist sucks though.
If its basically old DOS, isn't there a way to get TWX to MAKEDIR ?

Author:  Singularity [ Fri Jan 18, 2008 5:36 pm ]
Post subject:  Re: write file to new directory

Well, DOS paths. I don't know of a way to get it to do makedir, but direxists and makedir commands would be quite sweet.

Author:  wilber [ Fri Jan 18, 2008 7:10 pm ]
Post subject:  Re: write file to new directory

umm the old commands are mkdir and md not sure if you tried them
if so sorry to jump in

wilber

Author:  Parrothead [ Fri Jan 18, 2008 9:01 pm ]
Post subject:  Re: write file to new directory

Zarkahn wrote:
thaks guys
the ./worked fine
the directory having to exist sucks though.
If its basically old DOS, isn't there a way to get TWX to MAKEDIR ?


No....the Unix syntax workes also...

Author:  Singularity [ Fri Jan 18, 2008 9:20 pm ]
Post subject:  Re: write file to new directory

When I said it was "like DOS" I meant the path statements are like DOS, not TWXproxy. TWXproxy isn't like DOS at all, it does not have a makedir, mkdir or md command anywhere in the help file... and I doubt anywhere at all.

Author:  ElderProphet [ Sat Jan 19, 2008 1:00 am ]
Post subject:  Re: write file to new directory

TWX has no provision for creating directories. It's probably a bad idea in the long term to add directory creation and deletion options, and I think that file navigation to parent directories should probably be limited to the TWX root directory. I shudder to think of the havok that a malformed script could wreak with those capabilities.

+EP+

Page 1 of 2 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/