Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Delete multiple pages in AEM 6.3 following a naming pattern

Avatar

Avatar
Give Back 10
Level 3
karanmahi
Level 3

Likes

15 likes

Total Posts

73 posts

Correct Reply

0 solutions
Top badges earned
Give Back 10
Give Back 5
Give Back 3
Give Back
Ignite 5
View profile

Avatar
Give Back 10
Level 3
karanmahi
Level 3

Likes

15 likes

Total Posts

73 posts

Correct Reply

0 solutions
Top badges earned
Give Back 10
Give Back 5
Give Back 3
Give Back
Ignite 5
View profile
karanmahi
Level 3

27-08-2019

In AEM content hierarchy, I have a folder in which I have 4000 pages. And out of these pages, 3700 pages are following the naming convention of xyz-1, xyz-2, xyz-3..uptill xyz-3700 like this. I have a requirement to delete these pages starting with "xyz" but not the other 300 pages which have different names. I have tried below command with *, but this doesn’t work. Can anybody help me here to get this resolved?

curl  -F":operation=delete" -F":applyTo=/content/foo/bar/xyz*" http://localhost:4502 -u admin:admin

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 25
MVP
Himanshu_Singhal
MVP

Likes

65 likes

Total Posts

206 posts

Correct Reply

23 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 25
MVP
Himanshu_Singhal
MVP

Likes

65 likes

Total Posts

206 posts

Correct Reply

23 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 5
Give Back 3
View profile
Himanshu_Singhal
MVP

29-08-2019

As already recommended, both the bash script and workflow option are feasible and can get the work. However, I'd recommend to go with bash script cos' that would be hassle free with no deployment required and have more control over what you want do. Obviously, you can do with workflow as well but since it's not the usual thing and mostly needs to be done only once, so considering all those factors, bash script would be nice option.

Answers (2)

Answers (2)

Avatar

Avatar
Give Back 5
Level 4
joeb21688728
Level 4

Likes

33 likes

Total Posts

60 posts

Correct Reply

8 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 25
Give Back 10
Give Back
View profile

Avatar
Give Back 5
Level 4
joeb21688728
Level 4

Likes

33 likes

Total Posts

60 posts

Correct Reply

8 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 25
Give Back 10
Give Back
View profile
joeb21688728
Level 4

27-08-2019

I would look at writing a workflow and a custom step. Then query pages under an AEM path. Delete those that meet the name pattern. 

Avatar

Avatar
Give Back 5
Employee
SonDang
Employee

Likes

17 likes

Total Posts

43 posts

Correct Reply

9 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 5
View profile

Avatar
Give Back 5
Employee
SonDang
Employee

Likes

17 likes

Total Posts

43 posts

Correct Reply

9 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 5
View profile
SonDang
Employee

27-08-2019

As far as I can tell, the applyTo [1] will not work in this scenario (unless you want to list all the pages). I would suggest write a bash script that will loop through to delete these pages. [1] https://sling.apache.org/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-po...