Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
If I have a file structure that is several directories deep.
eg.
B:\DIR1\DIR2\DIR3
and I am currently in DIR3
How do I, in a single command, change back to B:\ ?
I know CHDIR .. takes me back one but CHDIR B:\ doesn't work.
Nick
Dylan Regular Member
Joined: 17/06/2013 Location: NetherlandsPosts: 81
Posted: 10:38am 26 Jun 2013
Copy link to clipboard
Print this post
..\..\.. perhaps?
Dylan Regular Member
Joined: 17/06/2013 Location: NetherlandsPosts: 81
Posted: 10:41am 26 Jun 2013
Copy link to clipboard
Print this post
wait, chdir never takes a drive anyway. Just chdir \ is supposed to work.
(each drive remembers its path)
JohnS Guru
Joined: 18/11/2011 Location: United KingdomPosts: 3802
Posted: 11:10am 26 Jun 2013
Copy link to clipboard
Print this post
Probably CHDIR B:\
John
BobD
Guru
Joined: 07/12/2011 Location: AustraliaPosts: 935
Posted: 11:30am 26 Jun 2013
Copy link to clipboard
Print this post
What he said. Follows is a quote from the V4.3a manual.
Change the current working directory on the SD card to ‘dir$’
The special entry “..” represents the parent of the current directory and
“.” represents the current directory.
It looks like you set DIR$ first then issue CHDIR it seems an odd way to do it.
shoebuckle Senior Member
Joined: 21/01/2012 Location: AustraliaPosts: 189
Posted: 12:52pm 26 Jun 2013
Copy link to clipboard
Print this post
As Dylan says"
CHDIR "..\..\.."
will get you back from DIR3 to B:\
Cheers,
Hugh
paceman Guru
Joined: 07/10/2011 Location: AustraliaPosts: 1329
Posted: 03:38pm 26 Jun 2013
Copy link to clipboard
Print this post
Well, there's an answer I should have asked the question to long ago. I've always kept the directory structure just one level deep because of this and it's made my directory lists rather longer than I'd like.
Greg
Nick
Guru
Joined: 09/06/2011 Location: AustraliaPosts: 512
Posted: 03:51pm 26 Jun 2013
Copy link to clipboard
Print this post
Yep. Leave out the drive letter.
I don't know which OS I was thinking. :)
Nick
Juri74
Senior Member
Joined: 06/02/2012 Location: ItalyPosts: 162
Posted: 10:57pm 26 Jun 2013
Copy link to clipboard
Print this post
Hello Nick!
if you want to go back to the root, no matter what subdirectory you are, try
Chdir "\"
Juri
Dylan Regular Member
Joined: 17/06/2013 Location: NetherlandsPosts: 81
Posted: 07:41am 27 Jun 2013
Copy link to clipboard
Print this post
I must admit, using the quotes is something I fail to do!