Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fish) function that checks that files in folder X exist in folder Y #10

Open
nonissue opened this issue Jan 19, 2021 · 1 comment
Open
Assignees
Labels
enhancement New feature or request fish Issues or ideas related to fish shell.

Comments

@nonissue
Copy link
Owner

For example, say you have a daily job to upload new local files to a remote storage device. In this scenario, once the files are successfully uploaded to the remote storage device (that is also setup as a mounted volume), we want to remove them from the local device to free up space. This function would accept a directory /path/to/dirX and verify all files contained within dirX are in /path/different/branch/of/file/tree/dirY.

Not sure the best to accurate compare the dirX/fileA with dirY/fileA though. md5 seems really slow on larger files, and we aren't OVERLY concerned about accuracy. Maybe just verify the file size is the same in bytes?

@nonissue nonissue self-assigned this Jan 19, 2021
@nonissue nonissue added enhancement New feature or request fish Issues or ideas related to fish shell. labels Jan 19, 2021
@nonissue
Copy link
Owner Author

Interestingly, running du -s on a known good file located both locally and remotely reveals slightly different results...

Maybe drop the last N digits?

Something like...
find /mnt/media/local/tv/ type f -exec du -s {} \; | string sub -l 5

Other things to resolve:

  • Skip files smaller than Nkb
  • Get both the file name and file size in one pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fish Issues or ideas related to fish shell.
Projects
None yet
Development

No branches or pull requests

1 participant