Liberty BASIC Community Forum
« name as »

Welcome Guest. Please Login or Register.
Jan 23rd, 2018, 7:17pm


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: name as  (Read 94 times)
alincon2001
Guru
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 510
xx name as
« Thread started on: Jan 13th, 2018, 9:46pm »

I'm trying to delete a file by 'name-ing' it to a different folder

folder a exists
folder a\a1 exists
folder a\a2 exists
file a\a2\f1 exists

Code:
 name "a\a2\f1" as "a\a1\f1"
 


the instruction fails with message "file "a\a1\f1" not found"
The help file says that it must not exist.
What am I doing wrong?
User IP Logged

MKnarr
Senior Member
ImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 432
xx Re: name as
« Reply #1 on: Jan 14th, 2018, 10:05am »

I'm not sure of your syntax but this works.
Code:
 name DefaultDir$+"\dummy.txt" as "C:\temp\e.txt" 


this does not
Code:
 name DefaultDir$+"\dummy.txt" as "C:\dummy\e.txt" 


because in the first case the folder temp exists . In the second case the folder dummy does not exist.

If you are really trying to delete a file why not use

Code:
 Kill a$ 


BTW if a is a folder don't you need the : after it.
« Last Edit: Jan 14th, 2018, 10:06am by MKnarr » User IP Logged

alincon2001
Guru
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 510
xx Re: name as
« Reply #2 on: Jan 14th, 2018, 11:21am »

I did not use 'kill' because I might want to restore the file later.

I now think the problem is trying to use an illegal character (/) in the new file name (3/4 instead of .75)

r.m.
User IP Logged

alincon2001
Guru
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 510
xx Re: name as
« Reply #3 on: Jan 16th, 2018, 6:34pm »

Just a clerical error. The path was complicated and I didn't get it all right.

rm
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls