Skip to content

Commit

Permalink
Supports real disks with some tools
Browse files Browse the repository at this point in the history
ls, rm and cat now support accessing real disks, not only disk images
  • Loading branch information
maxpat78 committed Feb 13, 2023
1 parent 99d71c7 commit e15c93a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion FATtools/scripts/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def _cat(v, args):
def cat(args):
for arg in args:
filt = None # wildcard filter
img = is_vdisk(arg) # image to open
img = is_vdisk(arg) # object to open
if not img: img = arg
path = arg[len(img)+1:] # eventual path inside it
v = Volume.vopen(img, 'rb+')
# wildcard? expand src list with matching items
Expand Down
5 changes: 3 additions & 2 deletions FATtools/scripts/ls.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ def ls(args, opts):
"Simple, DOS style directory listing, with size and last modification time"
for arg in args:
filt = None # wildcard filter
img = is_vdisk(arg) # image to open
img = is_vdisk(arg) # object to open
if not img: img = arg
path = arg[len(img)+1:] # eventual path inside it
v = Volume.vopen(img)
# wildcard? expand src list with matching items
Expand All @@ -124,7 +125,7 @@ def create_parser(parser_create_fn=argparse.ArgumentParser,parser_create_args=No
"""
par = parser_create_fn(*parser_create_args,usage=help_s,
formatter_class=argparse.RawDescriptionHelpFormatter,
description="Lists files and directories in a supported virtual disk image.\nWildcards accepted.",
description="Lists files and directories in a supported disk or image.\nWildcards accepted.",
epilog="Examples:\nfattools ls image.vhd\nfattools ls image.vhd/*.exe image.vhd/python39/dlls/*.pyd\n")
par.add_argument('items', nargs='+')
par.add_argument('-b', help='prints items names only', dest='bare', action="count", default=0)
Expand Down
5 changes: 3 additions & 2 deletions FATtools/scripts/rm.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ def _rm(v, args):
def rm(args):
for arg in args:
filt = None # wildcard filter
img = is_vdisk(arg) # image to open
img = is_vdisk(arg) # object to open
if not img: img = arg
path = arg[len(img)+1:] # eventual path inside it
v = Volume.vopen(img, 'rb+')
# wildcard? expand src list with matching items
Expand Down Expand Up @@ -70,7 +71,7 @@ def create_parser(parser_create_fn=argparse.ArgumentParser,parser_create_args=No
"""
par = parser_create_fn(*parser_create_args, usage=help_s,
formatter_class=argparse.RawDescriptionHelpFormatter,
description="Removes items from virtual volumes. Wildcards accepted.",
description="Removes items from supported disk or images. Wildcards accepted.",
epilog="Examples:\nrm.py image.vhd/texts/*.txt image.vhd/Dir1\n")
par.add_argument('items', nargs='+')
return par
Expand Down
2 changes: 1 addition & 1 deletion FATtools/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.7'
__version__ = '1.0.9'
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ part = Volume.vopen('MyDiskImage.img', 'r+b', 'partition0')
mkfat.exfat_mkfs(part, part.size)
```

- to order root directory table in USB drive X (easily, with GUI):
- to order items inside directory tables easily, with GUI:
```
fattools reordergui
```
Expand Down

0 comments on commit e15c93a

Please sign in to comment.