Skip to content

Instantly share code, notes, and snippets.

@JoJoDeveloping
Last active April 10, 2019 21:15
Show Gist options
  • Save JoJoDeveloping/01eda7d509ae19c5d094d19e265ab1ba to your computer and use it in GitHub Desktop.
Save JoJoDeveloping/01eda7d509ae19c5d094d19e265ab1ba to your computer and use it in GitHub Desktop.
$ ls -la pd/
total 12
drwxr-xr-x 3 myname myname 4096 Apr 10 23:08 .
drwxr-xr-x 5 myname myname 4096 Apr 10 23:08 ..
lrwxrwxrwx 1 myname myname 3 Apr 10 23:06 a -> b/c
drwxr-xr-x 3 myname myname 4096 Apr 10 23:05 b
pwd: /mnt/workfs/myname/Minecraft/Plugins/workspace/run/.
a: a
pth: pd/a
abs: /mnt/workfs/myname/Minecraft/Plugins/workspace/run/pd/a
can: /mnt/workfs/myname/Minecraft/Plugins/workspace/run/pd/b/c
parent: pd
parent-name: pd
parent-abs: /mnt/workfs/myname/Minecraft/Plugins/workspace/run/pd
parent-can: /mnt/workfs/myname/Minecraft/Plugins/workspace/run/pd
parent-pth: pd
File test = new File("pd/a");
System.out.println("a: "+test.getName());
System.out.println("pth: "+test.getPath());
System.out.println("abs: "+test.getAbsolutePath());
System.out.println("can: "+test.getCanonicalPath());
File parent = test.getParentFile();
System.out.println("parent: "+test.getParent());
System.out.println("parent-name: "+parent.getName());
System.out.println("parent-abs: "+parent.getAbsolutePath());
System.out.println("parent-can: "+parent.getCanonicalPath());
System.out.println("parent-pth: "+parent.getPath());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment