Skip to content

How to copy all files in a directory? #663

Answered by sagiegurari
nanoqsh asked this question in Q&A
Discussion options

You must be logged in to vote

@nanoqsh you can use glob_array with is_path_newer to find and copy files.

https://github.com/sagiegurari/duckscript/blob/master/docs/sdk.md#std__fs__GlobArray
https://github.com/sagiegurari/duckscript/blob/master/docs/sdk.md#stdfsispathnewer

so first use glob array to fetch all files recursively, than for/in loop over results and check if newer than target and if so copy.
this is glob copy implementation that you can use as an example:

https://github.com/sagiegurari/duckscript/blob/master/docs/sdk.md#source-13
(sorry for the loooong var names, its like that for internal duckscript commands that are implemented in duckscript to ensure nothing leaks)

Replies: 4 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@nanoqsh
Comment options

Comment options

You must be logged in to vote
1 reply
@nanoqsh
Comment options

Answer selected by nanoqsh
Comment options

You must be logged in to vote
2 replies
@nanoqsh
Comment options

@sagiegurari
Comment options

Comment options

You must be logged in to vote
1 reply
@nanoqsh
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants