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.


86 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. Our assignment help experts could address students' academic topics quite well. Thus, they can opt for our service if they have difficulty in writing the academic task.
    assignment help

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

    ReplyDelete
  9. 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
  10. ABC Assignment Help is an incomparable online Accounting assignment help company delivering excellent academic assignments, essays, coursework and reports. Through a team of over 3000 subject experts we ensure individual attention to every student making the assignment help experience completely personalized in nature. With our round the clock services, you can be assured of high grades every time.

    ReplyDelete
  11. Wow!! Great information you provide in your blog of Assignment Help. It gives me idea to write my assignment in effective and presentable manner. It really helps me a lot to score good grades at lower price. It is helping me in getting good academic ground. Experts are GEMS.
    Assignment Help Online
    Online Assignment Help
    Assignment Help Online Services
    Assignment Helper
    Assignment Assistance
    Assignment Help Experts
    Online Assignment Help Services

    ReplyDelete
  12. Having an assignment due tomorrow and understand you can’t do it yourself? But you’re afraid of delegating your paper to some scam services as well? Why not check edubirdie reviews on Scamfighter.net

    ReplyDelete
  13. 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
  14. Our team is officialy working 24x7 to offer you best service. Our team is having amazing knowledge and they are offering you all the assignment service so you can get by simply visiting studentsassignmenthelp.com. One of the best and latest service you can get here. Stop who are demanding for stats homework help, it's they you can easily get on our website.

    ReplyDelete
  15. 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
  16. 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
  17. Whether you’re planning to explore all opportunities, consider the job you really wanted in the first place, or just move up the career ladder, we may provide you "whitbread review" on Resume101.org to help you make the best choice.

    ReplyDelete
  18. 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
  19. Way of presentation in your article is most impressive. assignment help australia

    ReplyDelete
  20. 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
  21. Your essay is too difficult and you need some help? Hiring somebody on the Internet doesn’t sound like a good idea? At EssayTopicsMasters we have found a solution to your dilemma. Check out https://essaytopicsmasters.com/reviews/homeworkmarket-com review and find the writing service you may rely on.

    ReplyDelete
  22. 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
  23. Being an academic writer from past 5 years providing assignment help to college and university students also associated with Myassignmenthelp platform. I am dedicated in providing best online academic writing services to the college students at the affordable rates.

    ReplyDelete

  24. Studies show that around 56% of all students consider their homework as the most primary source of stress in their life. It is no wonder then these students constantly think of ‘who can do my homework ’ in UK. Fortunately for them, we provide expert homework help at very reasonable prices. Recent research has also revealed that on average students between the ages of 6 to 17 have to spend a little more than three and a half hours each day of their school life doing homework. Our aim is to cut the time you spent doing your homework by more than a half by offering homework online services in UK to students. We offer you with several extraordinary benefits that make us the best choice for you. Homework help uk

    personal statement writing
    ghostwriter
    coursework help

    ReplyDelete
  25. Writing a medical school personal statement is a rite of passage for future doctors and physicians. Nursingessaywriting.com offer you personal statement medical school samples. That you well studying in nursing specialty.

    ReplyDelete
  26. 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
  27. 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
  28. Download and install Vidmate App which is the best HD video downloader software available for Android. Get free latest HD movies, songs, and your favorite TV shows.

    ReplyDelete
  29. 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
  30. 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
  31. 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
  32. 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
  33. 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
  34. 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
  35. 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
  36. 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
  37. My Assignment Services Australia is Best Place to Make Your Best Assignment. We have a team of highly qualified assignment experts who always ready to help you with your assignment. We provide a lot of type assignment services regarding your assignment. Our aim is to provide the best online assignment help in Australia.

    ReplyDelete
  38. 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
  39. Very nice blog!!! This is really good blog information thanks for sharing. We are a reliable third party Garmin GPS Update company, offering technical GPS support for various types of technical any types solve errors.

    ReplyDelete
  40. Nice to be visiting your blog again, it has been months for me. Well this article that i've been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article. Thanks, great share.
    Job in Dubai

    ReplyDelete
  41. Garmin Map Update are obtainable for free, and if you need to download free updates of Garmin GPS satellite maps, our experts will tell you all about free, reliable and accurate Garmin map update.
    Garmin Map Updates
    Garmin GPS Update
    https://garmin-gpsupdate.blogspot.com/
    https://garminmap-update.tumblr.com/
    https://garmingpsupdate.travel.blog/
    Garmin GPS Updates

    ReplyDelete
  42. Our assignment help providers are an absolute genius when it comes to preparing papers with thoroughly researched content and the addition of accurate references and citations, wherever required. If you are in need of assignment helpers offering services par excellence, then get in touch with do my assignment providers today, and secure for yourself top-notch academic grades this semester. If you buy assignment online, then you will be able to meet the deadline without any extra burden. Apart from this, there are also other reasons for which such a beneficial help can be availed.

    ReplyDelete
  43. 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
  44. 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
  45. Everything is perfect with this work. The writer has managed to keep the article interesting while discussing some really serious points. This is not easily done. All the best.
    get assignment help online

    ReplyDelete
  46. This is a wonderful post. Thanks for sharing visit at Top seo agency 2019

    ReplyDelete
  47. 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
  48. 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
  49. 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
  50. Please let me know if you're looking for a writer for your site. You have some really great posts and I feel I would be a good asset. If you ever want to take some of the load off, I'd absolutely love to write some material for your blog. Please send me an email if interested. Thank you!
    Dissertation Writing Services

    ReplyDelete
  51. 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
  52. Networking Assignment Helpis a good source to complete your networking homework on time. Score high marks using effective online service providers.
    Network Assignment Help

    Networking Assignment Help

    Computer Network Assignment Help

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

    ReplyDelete
  54. Follow the immensely steps for Canon/Ij Setup. Obtain Canon Printer Setup with easy to do process. Reach experts in case of difficulty with Canon Printer Setup.

    ReplyDelete
  55. Though, many internet providers provide cheap internet. Important aspects before picking internet plans are the internet connection-type, Promotional offers from various providers like reward cards, contract buyout offers, and waived equipment fee.

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

    ReplyDelete
  57. IdealAssignmentHelp is here to help you in coping with your academic stress. We do not simply write an assignment for you, although you gain support from our experts to enhance your skills. If you get the My Assignment Help Then You have don't go here and there you have simply contact our expert team. Our expert available 24*7 and resolve you're all quires.

    ReplyDelete
  58. 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
  59. 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
  60. 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
  61. If you ever need a programmer resume - make sure to use these guys. Tried them once, they are awesome!

    ReplyDelete
  62. Get the privilege to check with the current status of the troubleshooting process that is handled by the Geek Support experts.
    geek squad chat
    Trend micro geek squad
    geek squad tech support
    geek squad chat
    geek squad tech support
    geek squad appointment

    ReplyDelete

  63. 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
  64. I suggest all members choose assignment help Australia for the best guideline in your academia. The perfect and expert assistant your requirement and learning assignment project by the university.

    ReplyDelete
  65. 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
  66. Generate your Gmail email address by calling on Gmail phone number

    If a user had created an email id years back and now for some reason want to use that Gmail id again, then they can engage with our Gmail customer service. Users can contact and report their queries. Our professionals will troubleshoot all your queries within no time. We have years of experience in handling all sorts of Gmail related query. https://www.contact-customer-service.co/gmail-phone-number/

    ReplyDelete
  67. You should use Google Homepage to surf the internet

    Google Homepage can give you a variety of options to use for your entertainment purposes. You can change your homepage settings and set the widgets accordingly. Even the homepage gives you a chance to browse through many web pages which are a must read. You can see the relevant content on the homepage. in just a few clicks you can visit multiple types of the website which you want to see. If you face any type of issue with your Google or its related product you can dial. https://www.emailcontacthelp.com/google-homepage.html

    ReplyDelete

  68. Contact Gmail Number To Get The One Stop Remedy For The Quick Resolution
    What you are needed to do for the purpose of fixing Gmail-related hitches & glitches, is to give a call at Gmail Number. For this, you should take tech aid as quickly as possible through which you can easily and effectively get rid of all your queries and doubts within few seconds. https://www.googlehome-page.com/gmail-customer-support-number/

    ReplyDelete

  69. 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
  70. 'I'm highly impressed by the piece of thoughts you have shared on this portal. all the best
    connect us on Assignment Help can shed your burden of assignments with a return of qualitative assignments.

    ReplyDelete
  71. 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
  72. Most of the Gmail users are not capable enough to fix their Gmail related problems on their own. Thus, they are required to get in touch experienced professionals and share the hurdles they are running into. Simply through Gmail Phone Number, users can do so and resolve almost all issues in no time. https://www.customerservicephone-number.com/gmail-customer-service-number/

    ReplyDelete





  73. 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

  74. 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
  75. Really i found this article more informative, thanks for sharing this article! Also Check here

    Download and install Vidmate App which is the best HD video downloader software available for Android. Get free latest HD movies, songs, and your favorite TV shows

    Vidmate App Download

    Vidmate apk for Android devices

    Vidmate App

    download Vidmate for Windows PC

    download Vidmate for Windows PC Free

    Vidmate Download for Windows 10

    Download Vidmate for iOS

    Download Vidmate for Blackberry

    Vidmate For IOS and Blackberry OS


    ReplyDelete
  76. 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

  77. 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
  78. If you are new McAfee antivirus user and facing any issue during Mcafee activate, then call us or visit our website.

    ReplyDelete