irods / irods_client_library_rirods

rirods R Package
https://rirods.irods4r.org
Other
6 stars 5 forks source link

Allow to rename data objects and collections in iget and iput when working with files #11

Closed chStaiger closed 1 year ago

chStaiger commented 1 year ago

Assign a new file name when downloading data from iRODS and when uploading data to iRODS

Case for downloading. In my workspace I already have

> list.files()
[1] "helloWorld.txt"  "penguins.csv"   

In iRODS I also have a file helloWorld.txt:

> ils()
                            logical_path        type
1           /bobZone/home/christine/test  collection
...
4 /bobZone/home/christine/helloWorld.txt data_object

When I now try to download the file, I get:

> iget("helloWorld.txt")
Error: Local file aready exists. Set `overwrite = TRUE` to explicitely overwrite the object.

Is it possible to rewrite the call for get and iput and get like this:

iget("helloWorld.txt", name="helloWorld1.txt", ... <all other parameter> )
iput("helloWorld.txt", name="helloWorld1.txt", ... <all other parameters>)
MartinSchobben commented 1 year ago

I am of the opinion that this should not be added to the function as an argument, but rather leave this to the user. Who would just do the following in R.

R objects

baz <- foo
iput(baz)

File

file.rename("foo.txt", "baz.txt")
iput("baz.txt")