cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

How to bulk clean the files that were moved to .unreferenced folder in Vault

AP_10483126
11-Garnet

How to bulk clean the files that were moved to .unreferenced folder in Vault

Version: Windchill 12.1

 

Use Case: To Clear the .unreferenced folders in windchill vault


Description:

Previously while executing the remove unreferenced files the check box "Move files instead of deleting" was selected hence all the unreferenced files are stored in the .unreferenced folders. How can be do a bulk clean up of all these .unreferenced?

5 REPLIES 5
BenLoosli
23-Emerald II
(To:AP_10483126)

I do not think that is part of Windchill functionality.

My only suggestion is to write a batch script that will go into each unreferenced folder and delete any files found there. Write with an IF statement to check for files in the folder before doing the deletion. Then have the script change to the next main folder's unreferenced sub folder and repeat.

I have not done this as I manually go into each folder and do the delete. I like to run the removal in Windchill a few days before I do the folder delete. I like to see how many unreferenced files we are generating. In most cases, I only run the removal on the last 10 folders on a regular basis. I will about once a year go through all of the folders.

 

Using Move files instead of deleting is a recommended practice.

In some releases/builds, RemoveUnreferencedFiles has removed referenced content files.

It is much easier to restore from the .unreferenced folder than to locate and restore the files from nightly backups.

 

Cleanup

First, validate there are no missing content files that might be in the .unreferenced folders.

windchill wt.fv.tools.WContentVerify
Then, search the physical file vaults for ".unreferenced" folders and delete all of them.

They will be recreated if remove unreferenced files is run again with the move option set.

BenLoosli
23-Emerald II
(To:mmeadows-3)

The default option is to delete the unreferenced files.

I had opened an Idea to make that setting a preference so it could be Move as the default if the company wanted.

avillanueva
22-Sapphire II
(To:AP_10483126)

You can follow along with my example. Say you have a bunch of top level vault folders (you didn't mentioned if you were configured for root folders with automatic folder creation) like this:

defaultcachevault1

defaultcachevault2

mainvault

libraryvault

I had a script that would look for the .unreferenced folders inside there an move those files out to another folder which I can purge at my leisure. 

#!/bin/bash -x
DATE=`date +%Y%m%d`
DIR_TARGET_BASE="/<your data here>/unreferenced/$DATE"
DIR_BASE="/<your data here>"

for folder in $(find $DIR_BASE -type d -maxdepth 1 \( ! -name .snapshot \)); do
        DIR_SOURCE=${folder}/.unreferenced/
        DIR_VAULT=${folder##*/}
        DIR_TARGET="$DIR_TARGET_BASE/$DIR_VAULT/"
        echo "Moving ${DIR_SOURCE} to ${DIR_TARGET} .."
        mkdir -p "$DIR_TARGET"
        mv $DIR_SOURCE $DIR_TARGET
done

With automatic folder creation, I think you would want to change folder depth to 2 or you can run this in each of the root folders that you have. This will put all the unreferenced files in the vaults area into another folder by date. From there you can pinch off those folders to delete.

Hi @AP_10483126,

 

I wanted to follow up with you on your post to see if your question has been answered. 
If so, please mark the appropriate reply as the Accepted Solution. 
Of course, if you have more to share on your issue, please let the Community know so that we can continue to help you. 

 

Thanks,
Anurag

Announcements


Top Tags