Wednesday, December 12, 2012

How to remove non referenced node from DAM in CQ 5.5

Use Case: Clean your DAM to remove non referenced node.

Solution: You can use following script to remove all non referenced node from DAM.

# !/bin/bash
# Author: upadhyay.yogesh@gmail.com
# The host and port of the source server
SOURCE="localhost:4502"
# The user credentials on the source server (username:password)
SOURCE_CRED="admin:admin"
#Filter path
ROOT_PATH="/content/dam/<Your PATH>"
ALL_PATHS=`curl -s -u $SOURCE_CRED "$SOURCE/bin/querybuilder.json?path=$ROOT_PATH&type=dam:Asset&p.limit=-1" | tr ",[" "\n" | sed 's/ /%20/g' | grep path | awk -F \" '{print $4 "\n"}'`
echo "$ALL_PATHS"
for SINGLE_PATH in $ALL_PATHS
do
REFERENCE_COUNT=`curl -s -u $SOURCE_CRED "$SOURCE/bin/wcm/references.json?path=$SINGLE_PATH" | tr ",[" "\n" | sed 's/ /%20/g' | grep path | awk -F \" '{print $4 "\n"}'`
if [ "$REFERENCE_COUNT" == "" ] ; then
  echo "Removing $SINGLE_PATH"
  #curl -u $SOURCE_CRED -F:operation=delete $SOURCE$SINGLE_PATH
fi
done

Post Cleaning Step:

1) Run Data store garbage collection see http://www.wemblog.com/2012/03/how-to-run-online-backup-using-curl-in.html or http://helpx.adobe.com/crx/kb/DataStoreGarbageCollection.html for that)
2) Remove these nodes from publish as well if they are not deactivated already (usually deleting activated node should delete it from publish as well, But please check)

Caution: As always please test this. Also this might not cover Image referenced through CSS or your code. This only covers Image referenced through Image or Image related component.

Note: You can also use JSAWK https://github.com/micha/jsawk for better parsing of response.


51 comments:

  1. I'm blinded by the pure awesomeness of this script! :)) Thanks a lot!

    ReplyDelete
  2. This site is truly amazing my one of friend told me about this. And the theme is quite beautiful as well as the updated stuff also attract visitors to come and visit again. I would definitely bookmark it and would come back to you soon. Keep on updating.

    ReplyDelete
  3. Any example of how this can be done from a java class

    ReplyDelete
  4. Hi,
    This script will work for CQ5.6 as well ?
    And If I want to recreate this script to remove only videos from DAM, what change I could make ?
    Regards

    ReplyDelete
  5. Is it possible to get batch file equivalent for this script as my CQ is running on windows.

    ReplyDelete
  6. Do you need an assignment expert in Australia? Quit looking now, we are giving modest writing services to understudies. You can procure proficient scholastic scholars from Australia for your assignment. Our writers are accessible whenever you can contact at Australiaassignmenthelp.com.

    ReplyDelete
  7. Your information is absolutely correct and accurate. Thanks. assignment help

    ReplyDelete
  8. Do my cpm Homework? Our CPM homework helpers use accurate problem-solving strategies to come up with the right answers to each question in this course. Stuck with the questions in the course 1 of CPM? Get CPM homework help from us now!

    ReplyDelete
  9. Installation of Fashion Telecommunication Camera specializing in consulting, surveying and installation of CCTV systems Camera Wifi IP in Binh Duong, Binh Duong for households, shops, shops, corporate offices and factories.

    ReplyDelete
  10. Make a duplicate of the generation occurrences (creator and distribute). For instance with the CRX reinforcement Assignment Writing Service - Assignmentspot instrument Extract the reinforcements in a testing situation Start the occasions as is and debilitate the replication operators - so as to keep away from superfluous obstruction with the creation condition

    ReplyDelete
  11. Nice to be visiting your blog again, it has been months for me. Well this article that i’ve been waited for so long. essay help

    ReplyDelete
  12. Academic writing subjects help is most trust able Nursing assignment help from the writers of Singapore Assignment Help. Get cheap assignment help form our writers at affordable price with higher grade in your academics.

    ReplyDelete
  13. Way of presentation in your article is most impressive. assignment help australia

    ReplyDelete
  14. Get help in making your assignment and essay from the expert guidance on students assignment help. StudentsAssignmentHelp.com provide assignment & essay help Perth service to the students.

    ReplyDelete
  15. Are you looking for CHEAP TRANSLATION SERVICES SINGAPORE? You are at right place. Our Certified, Trusted, Fast & High Quality translators are available only for you at very affordable prices. For more details you can fetch us at email: info@singaporetranslators.com.

    ReplyDelete
  16. Truly decent and intriguing post. I was searching for this sort of data and appreciated perusing this one. Continue posting. A debt of gratitude is in order for sharing. assignment writing service

    ReplyDelete
  17. Excellent post. This article is very helpful for the people and also for me. I get the some useful knowledge in this post. Thanks for sharing the informative topic, by the way. all assignment help reviews

    ReplyDelete
  18. Nice blog. We provide better and most popular Assignment Help Online to our customers. This is a legal and reliable company. My professional assignment help online is well qualified to complete academic content for our customers. Assignment Help Online

    ReplyDelete
  19. Hi! I am Martinlutharz, available 24x7 to help out the needy ones who are suffering from issues related to their Apple devices. Whenever, you face any type of technical or non-technical issue associated with your Apple device, you can give a ring to ourApple Support Phone Numberat anytime and also from anywhere. Here, I and one of my colleagues will provide you get cent percent resolution for your entire issues within a quick succession of time.

    ReplyDelete
  20. Your information is very detailed and useful to me, thank you for sharing. I hope you will always be up to date. We also provide affordable MBA Assignment help in uk.

    ReplyDelete
  21. Singaporetranslators.com offers DOCUMENT TRANSLATION SERVICES SINGAPORE. We only use native professional translators who use less time to clear things. Our minimum charge is depending on the length of paper and type of papers. We provide affordable and reliable services to our customers.

    ReplyDelete
  22. Online assignment help Australia In A Click-PhD Experts 24/7
    Why choose us? We got 24/7 live support with 1450+ assignment expert with years of experience. 100% unique content with on time delivery. Instant online essay help with flat 20% off on your first order. Grab the deal now.
    Stop here! Get best macroeconomics assignment help online -order now
    Key features - 100% plagiarism free, on time delivery, 100% satisfied customers

    ReplyDelete
  23. Worrying for your essay? @GotoEssayHelp, we provide ultimate help with essay at very affordable prices. Our major focus is on satisfied students. Top class professional write my essay are now available to you in a click at best rates possible.
    Its time you avail our best in class MBA Essay Help and nursing essay help with the help of PhD native experts available 24/7 only for you.

    ReplyDelete
  24. Get Your printer issues fixed with our third party printer support team,if you have issues like HP Printer not printing it is a very common issue and can result from many dissimilar reasons like; missing or out-of-date drivers, faulty connections, bad configurations in Windows,etc. simple things like no ink or a paper jam can cause frustration with HP printer not printing.

    ReplyDelete
  25. I was redirected to this blog. I pressed the combination of words julie thao and here I am. It was not waste of time. I enjoyed reading this article.

    ReplyDelete
  26. You can go to approach for Epson Support to look out the expected change in it. With the association of this facility, an individual can check how much ink remain in printer before starting the printing work. A number of Epson wireless printer setup fluctuations come into real time action and no user has any idea to recover its error as quick as possible. . However, a few persons are facing technical issues in their Epson printer and can’t be able to recover its disorder within defined time. Any user is not compelled to accept its technical hindrance. In urgent situation, you can browse our web portal and support Epson error code 0xf1.

    ReplyDelete
  27. We are online assignment help specialists who provide the best programming assignment help for students studying in US at very reasonable prices.
    Assignment Help US
    Java assignment help

    ReplyDelete
  28. These social media marketing play a very crucial role in the marketing plans of hotels. Effects of Social media marketing has facilitated hotels with two-way communication with their clients about their services and property.

    ReplyDelete
  29. norton.com/setup - Norton security program can secure either one device or up to ten devices and keep the whole network safe from malware such as worms, spyware, rootkits, etc. For getting Norton Setup, visit norton.com/setup , norton.com/setup  , norton.com/setupoffice.com/setup MS Office is used by a lot of people on a variety of devices like Android, Mac, PC, laptops, and iOS. This Office setup is specially programmed and adapted to do an array of tasks. Microsoft Office provides a list of helpful and dynamic features to accomplish the majority of tasks. To get this amazing setup for any devices, visit  office.com/setup.

    ReplyDelete
  30. Thanks for Sharing this post , Hello friends, I am Robertjonz working with the Dell Support team for the last 3 years. In any case, if you face problem with your Dell device, then you can easily take help from me or the other experts, who are working with this organization. Our team and I are always ready to offer top-notch solutions to our customers’ queries within a short interval of time.

    For Tech issue :- Dell Tech Support

    For Customer issue :- Dell Customer Support number

    For Printer issue :- Dell Printer Support

    How To Screenshot On a Dell

    For driver :- Dell printer drivers

    ReplyDelete
  31. Norton is a trusted antivirus software providing system as well as network security. Go to www.norton.com to know the installation and setup process of Norton antivirus.

    ReplyDelete
  32. StudentsAssignmentHelp.com Provides The Best Service Of Urgent Assignment Help Services For UK And Australian College Students At The Best Prices. Our Company Work for Improves Your Grades and Make High-Quality Assignment Writing. Get your first order at minimal prices. Book now! For more information contact here- info@studentsassignmenthelp.com or + 44-755-536-9184

    ReplyDelete
  33. Hey! Thanks for sharing valuable information. I am jack nick and i am technician. I provide support for how to Update Garmin GPS.

    ReplyDelete
  34. when you want to get the train status updates from here

    ReplyDelete
  35. Norton have the total arrangement of elements which can ensure your advanced on the web and disconnected existence of the registering gadgets, and it help you to secure it as well as it can keep up the strength of your PC, increment the speed with inbuilt PC Optimization device. In the event that you just obtained Norton Retail Card from the store or online please visit www.norton.com/setup into your web program to reclaim and enact your Norton Security item on the web. norton.com/setup | norton.com/setup | norton.com/setup | norton.com/setup | norton.com/setup

    ReplyDelete
  36. office.com/setup is the official website of office setup. Here we are going to discuss about Office 365, Office 2016 and other Office setup and their latest updates. First of all we will discuss about how to download , install Office setup and activation process of Office setup to your Personal computer, laptop and for Mac and mobiles.
    norton.com/setup - If you are not using an antivirus on your system, then you are undoubtedly more prone to get malicious programs infected on your PC. Norton provides world’s best antivirus programs that can prevent harmful malware and viruses from infecting your system.

    ReplyDelete
  37. SBCGlobal is an email service which has users all across the globe. This email services provide the users with various features which help them with their daily requirement. The users can easily configure SBCGlobal email with Mozilla Thunderbird using some simple steps. The users can also connect with SBCGlobal is an email service which has users all across the globe. This email services provide the users with various features which help them with their daily requirement. The users can easily configure SBCGlobal email with Mozilla Thunderbird using some simple steps. The users can also connect with SBCGlobal Email Customer Care Number. This service is accessible throughout the day and is completely free of charge. Read more:- https://www.sbcglobal-mail.com/. This service is accessible throughout the day and is completely free of charge. Read more:- https://www.sbcglobal-mail.com/

    ReplyDelete
  38. If you ever need a programmer resume - make sure to use these guys. Tried them once, they are awesome!

    ReplyDelete

  39. If you want to get information about the job notification, exam and interview dates, and Sarkari Result. you will get many websites of the Government of India. You can easily find out the result for any Government examination.
    sarkariresult |
    sarkri result |
    serkari result |
    sarkari risult |
    sarakri result |
    sarkari resul |
    sarkari resut |
    sarakariresult |
    sarkari reasult |
    sharkari result |
    sarkai result |
    sarkari reslt |
    sarkariresult. |
    sarkari reslut |
    sarkari result. |
    sarkari result notification |
    sarkari resuilt |
    sarkariresul |
    srakari result |
    sarkari resutl |
    sarkari rijalt |
    sarari result |

    ReplyDelete
  40. We are an leading assistance provider of M.S office setup available 24*7 to listen and help customers in resolving their queries. As problems can crop at anytime at that time you can connect to office.com/setup to get resolve your queries.

    ReplyDelete

  41. Why To Seek Help When Gmail Help Number Is Here For You Only?
    Are you suffering from the Gmail security problems? Are you also facing setting related problems with your Google mail account? Sometimes, you might also come across several small hitches and glitches while working on the same. In such a case, consider availing Gmail Help from the experts would be right remedy for you! https://www.callphonenumber.net/gmail-support/

    ReplyDelete
  42. Whether you want to fix your problems such as login troubles, password hurdles, security issues and many more or you are looking forward to getting the real time help to enhance the experience on Gmail, Just get in touch with the experts who are capable of fixing all your problems in no time via Gmail Help number. https://www.getcustomerservice.org/gmail-customer-service/

    ReplyDelete





  43. Recovery Of Forgot Gmail Password With The Aid Of Gmail Customer Service
    Are you facing problems while recovering Gmail password related problems? Are you one of those who are looking for the instant technical backing in order to tackle down each and every such issue which arises when it comes to recovering forgot Gmail account password? Make use of Gmail Customer Service at anytime! https://www.contact-customer-service.co/gmail-customer-service/

    ReplyDelete

  44. Unlimited Help Round The Clock At Your Service via Gmail Phone Number
    One of the best and real time modes of getting feasible possible solution along with the real time troubleshooting instructions is to make use of Gmail Phone Number if you are one of those who are seeking out the way to deal with all your hitches and glitches. Here, the right guidance will be given to you at your doorstep. https://www.contact-customer-service.co/gmail-phone-number/

    ReplyDelete
  45. Increase performance of Brother Printer Via Brother Printer Support

    Brother Printer helps you to root out all the hitches and glitches which would assist scale up the performance of your printing device. If you would like to opt for tricks and tips which would also help you keep your account safe as well as secured, Brother Printer Support can be availed and get the proficient solution. https://www.brotherprintersupportpro.net/

    ReplyDelete

  46. Learn About Troubleshooting Epson Printer Support Process For Any Issues

    Are you looking for the way to be acquainted with the troubleshooting Epson Printer Support services in order to get the best assistance under the strict supervision of qualified and experienced customer care geeks? Here, they will direct you all the necessary help and support services in a step by step manner so that you could resolve all related problems.
    https://www.printersupportpro.net/epson-printer-support/

    ReplyDelete
  47. If you are new McAfee antivirus user and facing any issue during Mcafee activate, then call us or visit our website.

    ReplyDelete