Reputation: 11
This is the path when I have deleted the fie from the existing folder Moved: 'hdfs://nameservice1/user/edureka_978336/Assignment24/abc.txt' to trash at: hdfs://nameservice1/ user/edureka_978336/.Trash/Current/user/edureka_978336/Assignment24/abc.txt
Where Im trying to restore it through MV function but it's not working
hdfs dfs -mv /user/edureka_978336/.Trash/Current/user/edureka_978336/Assignment24/abc.txt/user/edureka_978336/Asign ment24
Upvotes: 0
Views: 1048
Reputation: 787
Can you paste the error which is coming when you say it's not working.
hdfs dfs -mv sourcePath targetPath
This command should work for moving the file back from trash. Make sure you have permission to pull the data from trash. Can try running with sudo :
sudo -u <user.name> hdfs dfs -mv sourcePath targetPath
Upvotes: 1
Reputation: 12831
Actually the move should work, if all your paths are correct.
But the important thing is, for how much time the files are retained in Trash.
This value is configured in core-site.xml as shown below.
<property>
<name>fs.trash.interval</name>
<value>30</value>
</property>
The value is in minutes and the files will be permanently deleted, after the specified time.
More details about restoring the file here. Take a look.
https://www.linkedin.com/pulse/recovering-deleted-hdfs-files-cloudera-certified-developer-hadoop-/
Upvotes: 0